From 79d3004e26f490ef37ae0298495ea66f322ce374 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 24 Jul 2007 22:11:00 +0000 Subject: 2007-07-24 Havoc Pennington * configure.in: add AM_PROG_CC_C_O to allow per-target CPPFLAGS * bus/dispatch.c (bus_dispatch_test_conf): Fix up setting TEST_LAUNCH_HELPER_CONFIG to include the full path, and enable test shell_fail_service_auto_start when use_launcher==TRUE * bus/activation-helper-bin.c (convert_error_to_exit_code): pass through the INVALID_ARGS error so the test suite works * bus/activation.c (handle_activation_exit_error): return DBUS_ERROR_NO_MEMORY if we get BUS_SPAWN_EXIT_CODE_NO_MEMORY * dbus/dbus-spawn.c (_dbus_babysitter_get_child_exit_status): return only the exit code of the child, not the entire thingy from waitpid(), and make the return value indicate whether the child exited normally (with a status code) * bus/bus.c (process_config_first_time_only): _dbus_strdup works on NULL so no need to check (process_config_every_time): move servicehelper init here, so we reload it on HUP or config file change * bus/Makefile.am (install-data-hook): remove comment because Emacs make mode seems to be grumpy about it --- bus/bus.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'bus/bus.c') diff --git a/bus/bus.c b/bus/bus.c index 627e49d3..21e8037e 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -254,8 +254,9 @@ setup_server (BusContext *context, } /* This code only gets executed the first time the - config files are parsed. It is not executed - when config files are reloaded.*/ + * config files are parsed. It is not executed + * when config files are reloaded. + */ static dbus_bool_t process_config_first_time_only (BusContext *context, BusConfigParser *parser, @@ -263,7 +264,7 @@ process_config_first_time_only (BusContext *context, { DBusList *link; DBusList **addresses; - const char *user, *pidfile, *servicehelper; + const char *user, *pidfile; char **auth_mechanisms; DBusList **auth_mechanisms_list; int len; @@ -299,11 +300,6 @@ process_config_first_time_only (BusContext *context, /* keep around the pid filename so we can delete it later */ context->pidfile = _dbus_strdup (pidfile); - /* we need to configure this so we can test the service helper */ - servicehelper = bus_config_parser_get_servicehelper (parser); - if (servicehelper != NULL) - context->servicehelper = _dbus_strdup (servicehelper); - /* Build an array of auth mechanisms */ auth_mechanisms_list = bus_config_parser_get_mechanisms (parser); @@ -398,8 +394,11 @@ process_config_first_time_only (BusContext *context, } /* This code gets executed every time the config files - are parsed: both during BusContext construction - and on reloads. */ + * are parsed: both during BusContext construction + * and on reloads. This function is slightly screwy + * since it can do a "half reload" in out-of-memory + * situations. Realistically, unlikely to ever matter. + */ static dbus_bool_t process_config_every_time (BusContext *context, BusConfigParser *parser, @@ -411,7 +410,9 @@ process_config_every_time (BusContext *context, DBusList **dirs; BusActivation *new_activation; char *addr; - + const char *servicehelper; + char *s; + dbus_bool_t retval; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -477,6 +478,21 @@ process_config_every_time (BusContext *context, /* get the service directories */ dirs = bus_config_parser_get_service_dirs (parser); + /* and the service helper */ + servicehelper = bus_config_parser_get_servicehelper (parser); + + s = _dbus_strdup(servicehelper); + if (s == NULL && servicehelper != NULL) + { + BUS_SET_OOM (error); + goto failed; + } + else + { + dbus_free(context->servicehelper); + context->servicehelper = s; + } + /* Create activation subsystem */ new_activation = bus_activation_new (context, &full_address, dirs, error); -- cgit