summaryrefslogtreecommitdiffstats
path: root/bus/bus.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-06 20:04:47 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-06 20:04:47 +0000
commitc8991b0f95a3b53bc98de9e029780bbe0a0b3114 (patch)
treea34064ca3cac6aba415b29079035866982cdbe0a /bus/bus.c
parentbc8b061eec0fd9de6552a9e6118c40283863b6dc (diff)
2003-04-06 Havoc Pennington <hp@pobox.com>
* bus/bus.c (bus_context_new): print the address in here, rather than in main(), because we need to do it before forking the daemon * bus/dispatch.c (send_service_nonexistent_error): set the sender on the service nonexistent error * bus/driver.c (bus_driver_handle_acquire_service): set the sender on the AcquireService reply * test/data/valid-config-files/debug-allow-all.conf.in: Make test server also listen on a UNIX socket so services can connect to it.
Diffstat (limited to 'bus/bus.c')
-rw-r--r--bus/bus.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/bus/bus.c b/bus/bus.c
index e426706a..880f35d1 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -298,6 +298,7 @@ setup_server (BusContext *context,
BusContext*
bus_context_new (const DBusString *config_file,
+ int print_addr_fd,
DBusError *error)
{
BusContext *context;
@@ -498,6 +499,48 @@ bus_context_new (const DBusString *config_file,
goto failed;
}
+ /* Note that we don't know whether the print_addr_fd is
+ * one of the sockets we're using to listen on, or some
+ * other random thing. But I think the answer is "don't do
+ * that then"
+ */
+ if (print_addr_fd >= 0)
+ {
+ DBusString addr;
+ const char *a = bus_context_get_address (context);
+ int bytes;
+
+ _dbus_assert (a != NULL);
+ if (!_dbus_string_init (&addr))
+ {
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ if (!_dbus_string_append (&addr, a) ||
+ !_dbus_string_append (&addr, "\n"))
+ {
+ _dbus_string_free (&addr);
+ BUS_SET_OOM (error);
+ goto failed;
+ }
+
+ bytes = _dbus_string_get_length (&addr);
+ if (_dbus_write (print_addr_fd, &addr, 0, bytes) != bytes)
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Printing message bus address: %s\n",
+ _dbus_strerror (errno));
+ _dbus_string_free (&addr);
+ goto failed;
+ }
+
+ if (print_addr_fd > 2)
+ _dbus_close (print_addr_fd, NULL);
+
+ _dbus_string_free (&addr);
+ }
+
/* Create activation subsystem */
context->activation = bus_activation_new (context, &full_address,