[at-spi2-core: 9/32] Use a helper variable for the --address command line argument
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core: 9/32] Use a helper variable for the --address command line argument
- Date: Tue, 14 Dec 2021 22:30:56 +0000 (UTC)
commit 146f5f55d05f59097005ae0ce176e6b5d8547ccf
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Dec 9 18:10:52 2021 -0600
Use a helper variable for the --address command line argument
It's awkward to fiddle with argv[HARDCODED_NUMBER] later.
bus/at-spi-bus-launcher.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index 946395db..59a66600 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -339,7 +339,18 @@ setup_bus_child_daemon (gpointer data)
static gboolean
ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
{
- char *argv[] = { DBUS_DAEMON, config_path, "--nofork", "--print-address", "3", NULL, NULL };
+ char *address_param;
+
+ if (app->socket_name)
+ {
+ address_param = g_strconcat ("--address=unix:path=", app->socket_name, NULL);
+ }
+ else
+ {
+ address_param = NULL;
+ }
+
+ char *argv[] = { DBUS_DAEMON, config_path, "--nofork", "--print-address", "3", address_param, NULL };
GPid pid;
char addr_buf[2048];
GError *error = NULL;
@@ -350,9 +361,6 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
g_clear_pointer (&app->a11y_launch_error_message, g_free);
- if (app->socket_name)
- argv[5] = g_strconcat ("--address=unix:path=", app->socket_name, NULL);
-
if (!g_spawn_async (NULL,
argv,
NULL,
@@ -365,11 +373,11 @@ ensure_a11y_bus_daemon (A11yBusLauncher *app, char *config_path)
app->a11y_bus_pid = -1;
app->a11y_launch_error_message = g_strdup (error->message);
g_clear_error (&error);
- g_free (argv[5]);
+ g_free (address_param);
goto error;
}
- g_free (argv[5]);
+ g_free (address_param);
close (app->pipefd[1]);
app->pipefd[1] = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]