summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIkey Doherty <michael.i.doherty@intel.com>2016-03-12 16:43:16 +0000
committerMike Gorse <mgorse@suse.com>2016-03-14 16:59:30 -0500
commit2ef0076968e939d14b98425bcfc53ca2dc50f768 (patch)
tree147ac099b7bdc9f13788043155938bcefbf55839
parent404b3fe9325bd81145a2ce0704b552dcf5f250e2 (diff)
downloadat-spi2-core-2ef0076968e939d14b98425bcfc53ca2dc50f768.tar.gz
Support a stateless configuration by default
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>
-rw-r--r--bus/Makefile.am3
-rw-r--r--bus/at-spi-bus-launcher.c10
2 files changed, 10 insertions, 3 deletions
diff --git a/bus/Makefile.am b/bus/Makefile.am
index d9664abb..b189e027 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -1,11 +1,12 @@
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)
diff --git a/bus/at-spi-bus-launcher.c b/bus/at-spi-bus-launcher.c
index c445be8f..7ea82832 100644
--- a/bus/at-spi-bus-launcher.c
+++ b/bus/at-spi-bus-launcher.c
@@ -272,11 +272,17 @@ ensure_a11y_bus (A11yBusLauncher *app)
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));