diff options
author | Federico Mena Quintero <federico@gnome.org> | 2021-12-10 19:23:12 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2021-12-13 16:40:24 -0600 |
commit | d010e13360714670ba78729180207c33069f625d (patch) | |
tree | b5ea1d238d56eb4e57008d7d42f9735b0661bdfc /bus | |
parent | 8a232a703779ca73356f4b1569971e3f01920dcd (diff) | |
download | at-spi2-core-d010e13360714670ba78729180207c33069f625d.tar.gz |
Use g_spawn_async_with_pipes_and_fds() to pass down a specific FD
Otherwise, g_spawn_async() closes everything except
stdin/stdout/stderr. How very neat of it :)
Diffstat (limited to 'bus')
-rw-r--r-- | bus/at-spi-bus-launcher.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c index 64b4ddda..8df85c22 100644 --- a/bus/at-spi-bus-launcher.c +++ b/bus/at-spi-bus-launcher.c @@ -356,6 +356,8 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path) char *print_address_fd_param = g_strdup_printf ("%d", app->pipefd[1]); char *argv[] = { DBUS_DAEMON, config_path, "--nofork", "--print-address", print_address_fd_param, address_param, NULL }; + gint source_fds[1] = { app->pipefd[1] }; + gint target_fds[1] = { app->pipefd[1] }; GPid pid; char addr_buf[2048]; GError *error = NULL; @@ -363,14 +365,23 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path) g_clear_pointer (&app->a11y_launch_error_message, g_free); - if (!g_spawn_async (NULL, - argv, - NULL, - G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, - setup_bus_child_daemon, - app, - &pid, - &error)) + if (!g_spawn_async_with_pipes_and_fds (NULL, + (const gchar * const *) argv, + NULL, + G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, + setup_bus_child_daemon, + app, + -1, /* stdin_fd */ + -1, /* stdout_fd */ + -1, /* stdout_fd */ + source_fds, + target_fds, + 1, /* n_fds in source_fds and target_fds */ + &pid, + NULL, /* stdin_pipe_out */ + NULL, /* stdout_pipe_out */ + NULL, /* stderr_pipe_out */ + &error)) { app->a11y_bus_pid = -1; app->a11y_launch_error_message = g_strdup (error->message); |