From e45e4382274149ca60c11f068ccca719f3598074 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 6 Apr 2003 18:03:03 +0000 Subject: 2003-04-06 Havoc Pennington * bus/bus.c (bus_context_new): fix wrong handling of server_data_slot_unref() in the error case. * dbus/dbus-internals.h (_dbus_assert): change so it passes "(condition) != 0" to _dbus_real_assert so that "_dbus_assert (pointer)" doesn't cause a warning * bus/main.c (main): accept --print-address option to print out the message bus address * dbus/dbus-sysdeps.c (_dbus_generate_random_ascii): export this * dbus/dbus-transport.c (_dbus_transport_open): special error for "tmpdir" option to unix: address on client side * dbus/dbus-server.c (dbus_server_listen): handle "tmpdir" option to unix: address * configure.in (TEST_SOCKET_DIR): locate a temporary directory we can use to create sockets in the test suite. * bus/main.c (signal_handler): on SIGTERM, exit the daemon cleanly. To be used for testing. * dbus/dbus-spawn.c (babysit): use _dbus_set_signal_handler() * dbus/dbus-sysdeps.c (_dbus_set_signal_handler): new * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): handle trying to call this when there's no servers active --- bus/bus.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bus/bus.c') diff --git a/bus/bus.c b/bus/bus.c index 6c5a3f28..e426706a 100644 --- a/bus/bus.c +++ b/bus/bus.c @@ -107,7 +107,10 @@ server_get_context (DBusServer *server) bd = BUS_SERVER_DATA (server); if (bd == NULL) - return NULL; + { + server_data_slot_unref (); + return NULL; + } context = bd->context; @@ -314,7 +317,7 @@ bus_context_new (const DBusString *config_file, BUS_SET_OOM (error); return NULL; } - + if (!server_data_slot_ref ()) { BUS_SET_OOM (error); @@ -339,6 +342,12 @@ bus_context_new (const DBusString *config_file, context->refcount = 1; + /* we need another ref of the server data slot for the context + * to own + */ + if (!server_data_slot_ref ()) + _dbus_assert_not_reached ("second ref of server data slot failed"); + #ifdef DBUS_BUILD_TESTS context->activation_timeout = 6000; /* 6 seconds */ #else @@ -542,6 +551,7 @@ bus_context_new (const DBusString *config_file, bus_config_parser_unref (parser); _dbus_string_free (&full_address); dbus_free_string_array (auth_mechanisms); + server_data_slot_unref (); return context; @@ -678,6 +688,12 @@ bus_context_get_type (BusContext *context) return context->type; } +const char* +bus_context_get_address (BusContext *context) +{ + return context->address; +} + BusRegistry* bus_context_get_registry (BusContext *context) { -- cgit