summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2021-12-09 18:14:46 -0600
committerFederico Mena Quintero <federico@gnome.org>2021-12-13 16:39:29 -0600
commit8a232a703779ca73356f4b1569971e3f01920dcd (patch)
tree6feb5abcb32a4a8163700bd71db9f509043bf1df /bus
parent146f5f55d05f59097005ae0ce176e6b5d8547ccf (diff)
downloadat-spi2-core-8a232a703779ca73356f4b1569971e3f01920dcd.tar.gz
Don't pass a hardcoded file descriptor to --print-address
Instead just use whatever the write end of pipe() is. I don't like the idea of dup2() unconditionally closing fd=3.
Diffstat (limited to 'bus')
-rw-r--r--bus/at-spi-bus-launcher.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 59a66600..64b4ddda 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -350,15 +350,17 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
address_param = NULL;
}
- char *argv[] = { DBUS_DAEMON, config_path, "--nofork", "--print-address", "3", address_param, NULL };
+ if (pipe (app->pipefd) < 0)
+ g_error ("Failed to create pipe: %s", strerror (errno));
+
+ 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 };
GPid pid;
char addr_buf[2048];
GError *error = NULL;
char *error_from_read;
- if (pipe (app->pipefd) < 0)
- g_error ("Failed to create pipe: %s", strerror (errno));
-
g_clear_pointer (&app->a11y_launch_error_message, g_free);
if (!g_spawn_async (NULL,
@@ -374,10 +376,12 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
app->a11y_launch_error_message = g_strdup (error->message);
g_clear_error (&error);
g_free (address_param);
+ g_free (print_address_fd_param);
goto error;
}
g_free (address_param);
+ g_free (print_address_fd_param);
close (app->pipefd[1]);
app->pipefd[1] = -1;