summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-05-21 12:54:34 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-05-21 12:54:34 +0200
commit80fbf05e75b75b7dd342ec844275efae90c479ec (patch)
tree628670675a636a0532e5fa8da51bcdef47e73b8a /src/core/manager.c
parentc0ef53aa5b54e2b1d4abe316ebb12d3e1d0d9250 (diff)
dbus-unit: always load the unit before handling a message for it
We need to be able to show the properties even of inactive units. systemctl loads the unit before getting its properties, but this is racy as the garbage collector may kick in right after the loading. Fix it by always loading the unit before handling a message for it. https://bugzilla.redhat.com/show_bug.cgi?id=814966#c6
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index bd86f89d53..f8fb8a23e7 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1490,9 +1490,10 @@ int manager_loop(Manager *m) {
return m->exit_code;
}
-int manager_get_unit_from_dbus_path(Manager *m, const char *s, Unit **_u) {
+int manager_load_unit_from_dbus_path(Manager *m, const char *s, DBusError *e, Unit **_u) {
char *n;
Unit *u;
+ int r;
assert(m);
assert(s);
@@ -1501,14 +1502,15 @@ int manager_get_unit_from_dbus_path(Manager *m, const char *s, Unit **_u) {
if (!startswith(s, "/org/freedesktop/systemd1/unit/"))
return -EINVAL;
- if (!(n = bus_path_unescape(s+31)))
+ n = bus_path_unescape(s+31);
+ if (!n)
return -ENOMEM;
- u = manager_get_unit(m, n);
+ r = manager_load_unit(m, n, NULL, e, &u);
free(n);
- if (!u)
- return -ENOENT;
+ if (r < 0)
+ return r;
*_u = u;