diff options
author | Federico Mena Quintero <federico@gnome.org> | 2021-12-08 17:20:32 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2021-12-13 16:36:39 -0600 |
commit | 297d4c4ea5fd5579dc92ef32ef30b05d4f2fb448 (patch) | |
tree | 6b145be51fe3f7550e052b67836051f870f71e0e /bus | |
parent | c90335d31745a83ebcafd95e7d8b36709f8e11f1 (diff) | |
download | at-spi2-core-297d4c4ea5fd5579dc92ef32ef30b05d4f2fb448.tar.gz |
Extract function to prctl() the accessibility bus
Hopefully this makes it easier to port that to BSD, for example.
Diffstat (limited to 'bus')
-rw-r--r-- | bus/at-spi-bus-launcher.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c index 13f7d3bb..4c839ac7 100644 --- a/bus/at-spi-bus-launcher.c +++ b/bus/at-spi-bus-launcher.c @@ -286,7 +286,16 @@ on_bus_exited (GPid pid, app->a11y_launch_error_message = g_strdup_printf ("Bus stopped by signal %d", WSTOPSIG (status)); } g_main_loop_quit (app->loop); -} +} + +static void +set_bus_to_exit_if_this_process_dies (void) +{ +#ifdef __linux__ + /* Tell the bus process to exit if this process goes away */ + prctl (PR_SET_PDEATHSIG, SIGTERM); +#endif +} #ifdef DBUS_DAEMON static void @@ -299,10 +308,7 @@ setup_bus_child_daemon (gpointer data) dup2 (app->pipefd[1], 3); close (app->pipefd[1]); - /* On Linux, tell the bus process to exit if this process goes away */ -#ifdef __linux__ - prctl (PR_SET_PDEATHSIG, 15); -#endif + set_bus_to_exit_if_this_process_dies (); } static gboolean @@ -394,8 +400,7 @@ setup_bus_child_broker (gpointer data) g_setenv("LISTEN_PID", pid_str, TRUE); g_free(pid_str); - /* Tell the bus process to exit if this process goes away */ - prctl (PR_SET_PDEATHSIG, SIGTERM); + set_bus_to_exit_if_this_process_dies (); } static gboolean |