From 4076d31c71bee332c4a697597a93345b45850b33 Mon Sep 17 00:00:00 2001 From: Olivier Andrieu Date: Thu, 29 Jul 2004 08:00:45 +0000 Subject: * bus/config-loader-libxml.c: complete the implementation of libxml backend for config file loader. Doesn't work with full OOM test yet. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * configure.in: change error when selecting libxml into a warning. * test/data/invalid-config-files: add two non-well-formed XML files. * glib/Makefile.am: libdbus_gtool always uses expat, not libxml. * dbus/dbus-transport-unix.c (unix_handle_watch): do not disconnect in case of DBUS_WATCH_HANGUP, several do_reading() may be necessary to read all the buffer. (bug #894) * bus/activation.c (bus_activation_activate_service): fix a potential assertion failure (bug #896). Small optimization in the case of auto-activation messages. * dbus/dbus-message.c (verify_test_message, _dbus_message_test): add test case for byte-through-vararg bug (#901). patch by Kimmo Hämäläinen. --- bus/activation.c | 71 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 34 deletions(-) (limited to 'bus/activation.c') diff --git a/bus/activation.c b/bus/activation.c index e286ba9d..b799948f 100644 --- a/bus/activation.c +++ b/bus/activation.c @@ -44,7 +44,7 @@ struct BusActivation int refcount; DBusHashTable *entries; DBusHashTable *pending_activations; - char *server_address; + char *server_address; BusContext *context; int n_pending_activations; /**< This is in fact the number of BusPendingActivationEntry, * i.e. number of pending activation requests, not pending @@ -1319,40 +1319,46 @@ bus_activation_activate_service (BusActivation *activation, if (!entry) return FALSE; - /* Check if the service is active */ - _dbus_string_init_const (&service_str, service_name); - if (bus_registry_lookup (bus_context_get_registry (activation->context), &service_str) != NULL) + /* Bypass the registry lookup if we're auto-activating, bus_dispatch would not + * call us if the service is already active. + */ + if (!auto_activation) { - _dbus_verbose ("Service \"%s\" is already active\n", service_name); + /* Check if the service is active */ + _dbus_string_init_const (&service_str, service_name); + if (bus_registry_lookup (bus_context_get_registry (activation->context), &service_str) != NULL) + { + _dbus_verbose ("Service \"%s\" is already active\n", service_name); - message = dbus_message_new_method_return (activation_message); + message = dbus_message_new_method_return (activation_message); - if (!message) - { - _dbus_verbose ("No memory to create reply to activate message\n"); - BUS_SET_OOM (error); - return FALSE; - } + if (!message) + { + _dbus_verbose ("No memory to create reply to activate message\n"); + BUS_SET_OOM (error); + return FALSE; + } - if (!dbus_message_append_args (message, - DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE, - DBUS_TYPE_INVALID)) - { - _dbus_verbose ("No memory to set args of reply to activate message\n"); - BUS_SET_OOM (error); - dbus_message_unref (message); - return FALSE; - } + if (!dbus_message_append_args (message, + DBUS_TYPE_UINT32, DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE, + DBUS_TYPE_INVALID)) + { + _dbus_verbose ("No memory to set args of reply to activate message\n"); + BUS_SET_OOM (error); + dbus_message_unref (message); + return FALSE; + } - retval = bus_transaction_send_from_driver (transaction, connection, message); - dbus_message_unref (message); - if (!retval) - { - _dbus_verbose ("Failed to send reply\n"); - BUS_SET_OOM (error); - } + retval = bus_transaction_send_from_driver (transaction, connection, message); + dbus_message_unref (message); + if (!retval) + { + _dbus_verbose ("Failed to send reply\n"); + BUS_SET_OOM (error); + } - return retval; + return retval; + } } pending_activation_entry = dbus_new0 (BusPendingActivationEntry, 1); @@ -1504,11 +1510,8 @@ bus_activation_activate_service (BusActivation *activation, * argv[0] */ - if (activated == TRUE) - { - pending_activation->babysitter = NULL; - return TRUE; - } + if (activated) + return TRUE; /* Now try to spawn the process */ argv[0] = entry->exec; -- cgit