diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-07-02 15:49:27 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-07-02 15:49:27 +0200 |
commit | 8aec412ff697bc14995746953912ca6fdf2c9ba8 (patch) | |
tree | e88fe2eacac802ba521a6378871e1212f11dec2f /src/core | |
parent | 97e67f1e52ddc0c21a88cfbcab57e83c59ee627d (diff) |
machined: sync to /run after job completed
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/dbus-unit.c | 32 | ||||
-rw-r--r-- | src/core/unit.c | 9 |
2 files changed, 27 insertions, 14 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index ad6d5a6038..5831046305 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -778,16 +778,18 @@ static int bus_unit_set_transient_property( assert(i); if (streq(name, "Description")) { - const char *description; - if (dbus_message_iter_get_arg_type(i) != DBUS_TYPE_STRING) return -EINVAL; - dbus_message_iter_get_basic(i, &description); + if (mode != UNIT_CHECK) { + const char *description; - r = unit_set_description(u, description); - if (r < 0) - return r; + dbus_message_iter_get_basic(i, &description); + + r = unit_set_description(u, description); + if (r < 0) + return r; + } return 1; @@ -800,14 +802,20 @@ static int bus_unit_set_transient_property( dbus_message_iter_get_basic(i, &s); - r = manager_load_unit(u->manager, s, NULL, error, &slice); - if (r < 0) - return r; + if (isempty(s)) { + if (mode != UNIT_CHECK) + unit_ref_unset(&u->slice); + } else { + r = manager_load_unit(u->manager, s, NULL, error, &slice); + if (r < 0) + return r; - if (slice->type != UNIT_SLICE) - return -EINVAL; + if (slice->type != UNIT_SLICE) + return -EINVAL; - unit_ref_set(&u->slice, slice); + if (mode != UNIT_CHECK) + unit_ref_set(&u->slice, slice); + } return 1; } diff --git a/src/core/unit.c b/src/core/unit.c index 991111ab31..acc575b6e0 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -231,8 +231,13 @@ int unit_set_description(Unit *u, const char *description) { assert(u); - if (!(s = strdup(description))) - return -ENOMEM; + if (isempty(description)) + s = NULL; + else { + s = strdup(description); + if (!s) + return -ENOMEM; + } free(u->description); u->description = s; |