summaryrefslogtreecommitdiff
path: root/src/dbus-unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-21 05:00:29 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-21 05:00:29 +0200
commita7f241db3f1ae96ab2708092e1b31d2feb989947 (patch)
treed48588845b8d22658eb7a46bee49d58ec528716d /src/dbus-unit.c
parent672c48cc065251ddbdc3926221e8a7718241cccd (diff)
unit: deduce following unit value dynamically instead of statically, to avoid dangling pointers
Diffstat (limited to 'src/dbus-unit.c')
-rw-r--r--src/dbus-unit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dbus-unit.c b/src/dbus-unit.c
index bb2541800a..d25f325013 100644
--- a/src/dbus-unit.c
+++ b/src/dbus-unit.c
@@ -48,7 +48,7 @@ int bus_unit_append_names(Manager *m, DBusMessageIter *i, const char *property,
}
int bus_unit_append_following(Manager *m, DBusMessageIter *i, const char *property, void *data) {
- Unit *u = data;
+ Unit *u = data, *f;
const char *d;
assert(m);
@@ -56,7 +56,8 @@ int bus_unit_append_following(Manager *m, DBusMessageIter *i, const char *proper
assert(property);
assert(u);
- d = u->meta.following ? u->meta.following->meta.id : "";
+ f = unit_following(u);
+ d = f ? f->meta.id : "";
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &d))
return -ENOMEM;