summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-08-09 17:02:09 +0200
committerLennart Poettering <lennart@poettering.net>2010-08-09 17:07:05 +0200
commit04ade7d215ce05f1ac2bd33a8d6126f6994168fa (patch)
treec3e170de2068995fea15134a837eece2271f89d5
parent6d4fc029d9c6647927f3b73235d5d5bb17ce46ee (diff)
dbus: don't call bus_path_escape() with NULL unit name
Fixes an assertion triggerable via D-Bus. https://bugzilla.redhat.com/show_bug.cgi?id=622008
-rw-r--r--src/dbus-unit.c6
-rw-r--r--src/unit.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index d25f325013..c9ccac1472 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -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;
diff --git a/src/unit.c b/src/unit.c
index 840c1d1fc4..dd665e2d5a 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -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;