X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fdbus.c;h=b0ae3e1ae7fd5975d796b1123cd460cfb4b9bedd;hb=5b1869eaa22e365ab6595924fe96549b279b5ebc;hp=c1bf25c69bbb069b45312a0298e607f7bcb0d400;hpb=b170dd803d334234ad7edd0dc7bb34860832bc07;p=elogind.git diff --git a/src/core/dbus.c b/src/core/dbus.c index c1bf25c69..b0ae3e1ae 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -768,7 +768,7 @@ static void bus_new_connection( } static int init_registered_system_bus(Manager *m) { - char *id; + char *id = NULL; if (!dbus_connection_add_filter(m->system_bus, system_bus_message_filter, m, NULL)) return log_oom(); @@ -836,7 +836,8 @@ static int init_registered_api_bus(Manager *m) { return r; if (m->running_as == SYSTEMD_USER) { - char *id; + char *id = NULL; + log_debug("Successfully connected to API D-Bus bus %s as %s", strnull((id = dbus_connection_get_server_id(m->api_bus))), strnull(dbus_bus_get_unique_name(m->api_bus))); @@ -1170,7 +1171,7 @@ static void shutdown_connection(Manager *m, DBusConnection *c) { JobBusClient *cl, *nextcl; LIST_FOREACH_SAFE(client, cl, nextcl, j->bus_client_list) { if (cl->bus == c) { - LIST_REMOVE(JobBusClient, client, j->bus_client_list, cl); + LIST_REMOVE(client, j->bus_client_list, cl); free(cl); } } @@ -1451,7 +1452,7 @@ void bus_broadcast_finished( usec_t userspace_usec, usec_t total_usec) { - DBusMessage *message; + _cleanup_dbus_message_unref_ DBusMessage *message = NULL; assert(m); @@ -1471,18 +1472,42 @@ void bus_broadcast_finished( DBUS_TYPE_UINT64, &total_usec, DBUS_TYPE_INVALID)) { log_oom(); - goto finish; + return; } if (bus_broadcast(m, message) < 0) { log_oom(); - goto finish; + return; } +} -finish: - if (message) - dbus_message_unref(message); +void bus_broadcast_reloading(Manager *m, bool active) { + + _cleanup_dbus_message_unref_ DBusMessage *message = NULL; + dbus_bool_t b = active; + + assert(m); + + message = dbus_message_new_signal("/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "Reloading"); + if (!message) { + log_oom(); + return; + } + + assert_cc(sizeof(usec_t) == sizeof(uint64_t)); + if (!dbus_message_append_args(message, + DBUS_TYPE_BOOLEAN, &b, + DBUS_TYPE_INVALID)) { + log_oom(); + return; + } + + + if (bus_broadcast(m, message) < 0) { + log_oom(); + return; + } } Set *bus_acquire_subscribed(Manager *m, DBusConnection *c) {