Using a stateless configuration, we ship sensible defaults in our vendor-config
file to live in the /usr/share/ filesystem, which is considered to be provided
by the vendor, and to all intents and purposes, read-only.
With this change we can fall-back to the vendor system configuration to
always do the right thing, in the absence of a local system administrator
configuration file in the /etc/ tree.
Notably, this saves users from the potential risks and pitfalls of so called
"three way merges" on upgrades, and offers the immediate benefit that one
can perform a factory reset of the software, simply by removing the relevant
file in /etc/.
This change also resolves a memory leak in the launch code, where a string
allocation was entirely unnecessary.
Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
CLEANFILES=
-busconfigdir = $(sysconfdir)/at-spi2
+busconfigdir = $(datadir)/defaults/at-spi2
busconfig_DATA = accessibility.conf
libexec_PROGRAMS = at-spi-bus-launcher
at_spi_bus_launcher_SOURCES = at-spi-bus-launcher.c
at_spi_bus_launcher_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DDATADIR=\"$(datadir)\" \
-DDBUS_DAEMON=\"$(DBUS_DAEMON)\"
at_spi_bus_launcher_CFLAGS = $(GIO_CFLAGS)
at_spi_bus_launcher_LDADD = $(GIO_LIBS) $(X_LIBS)
char *argv[] = { DBUS_DAEMON, NULL, "--nofork", "--print-address", "3", NULL };
char addr_buf[2048];
GError *error = NULL;
+ const char *config_path = NULL;
if (app->a11y_bus_pid != 0)
return FALSE;
-
- argv[1] = g_strdup_printf ("--config-file=%s/at-spi2/accessibility.conf", SYSCONFDIR);
+
+ if (g_file_test (SYSCONFDIR"/at-spi2/accessibility.conf", G_FILE_TEST_EXISTS))
+ config_path = "--config-file="SYSCONFDIR"/at-spi2/accessibility.conf";
+ else
+ config_path = "--config-file="DATADIR"/defaults/at-spi2/accessibility.conf";
+
+ argv[1] = config_path;
if (pipe (app->pipefd) < 0)
g_error ("Failed to create pipe: %s", strerror (errno));