[at-spi2-core] Support a stateless configuration by default



commit 2ef0076968e939d14b98425bcfc53ca2dc50f768
Author: Ikey Doherty <michael i doherty intel com>
Date:   Sat Mar 12 16:43:16 2016 +0000

    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>

 bus/Makefile.am           |    3 ++-
 bus/at-spi-bus-launcher.c |   10 ++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/bus/Makefile.am b/bus/Makefile.am
index d9664ab..b189e02 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 c445be8..7ea8283 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));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]