chiark / gitweb /
systemctl: fix waiting for jobs when using direct connections to PID 1 for dbus
authorLennart Poettering <lennart@poettering.net>
Sun, 4 Jan 2015 23:38:31 +0000 (00:38 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 5 Jan 2015 00:40:51 +0000 (01:40 +0100)
src/libsystemd/sd-bus/bus-util.c

index 29520f9..86b83db 100644 (file)
@@ -1638,13 +1638,21 @@ int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret) {
 
         d->bus = sd_bus_ref(bus);
 
+        /* When we are a bus client we match by sender. Direct
+         * connections OTOH have no initialized sender field, and
+         * hence we ignore the sender then */
         r = sd_bus_add_match(
                         bus,
                         &d->slot_job_removed,
+                        bus->bus_client ?
                         "type='signal',"
                         "sender='org.freedesktop.systemd1',"
                         "interface='org.freedesktop.systemd1.Manager',"
                         "member='JobRemoved',"
+                        "path='/org/freedesktop/systemd1'" :
+                        "type='signal',"
+                        "interface='org.freedesktop.systemd1.Manager',"
+                        "member='JobRemoved',"
                         "path='/org/freedesktop/systemd1'",
                         match_job_removed, d);
         if (r < 0)