]> err.no Git - systemd/commitdiff
dbus: don't call bus_path_escape() with NULL unit name
authorLennart Poettering <lennart@poettering.net>
Mon, 9 Aug 2010 15:02:09 +0000 (17:02 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 9 Aug 2010 15:07:05 +0000 (17:07 +0200)
Fixes an assertion triggerable via D-Bus.

https://bugzilla.redhat.com/show_bug.cgi?id=622008

src/dbus-unit.c
src/unit.c

index d25f325013973deee12acb7c13f37a7bc65a5a02..c9ccac1472f9937a18a376c5f744460092b823cc 100644 (file)
@@ -434,6 +434,9 @@ void bus_unit_send_change_signal(Unit *u) {
                 u->meta.in_dbus_queue = false;
         }
 
+        if (!u->meta.id)
+                return;
+
         if (!bus_has_subscriber(u->meta.manager)) {
                 u->meta.sent_dbus_new_signal = true;
                 return;
@@ -491,6 +494,9 @@ void bus_unit_send_removed_signal(Unit *u) {
         if (!u->meta.sent_dbus_new_signal)
                 bus_unit_send_change_signal(u);
 
+        if (!u->meta.id)
+                return;
+
         if (!(p = unit_dbus_path(u)))
                 goto oom;
 
index 840c1d1fc450556e56ce79b87045b1980eece2d0..dd665e2d5a0bfc321282e08678183bc13b278ee9 100644 (file)
@@ -1551,6 +1551,9 @@ char *unit_dbus_path(Unit *u) {
 
         assert(u);
 
+        if (!u->meta.id)
+                return NULL;
+
         if (!(e = bus_path_escape(u->meta.id)))
                 return NULL;