diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/dbus-unit.c | 32 | ||||
-rw-r--r-- | src/core/unit.c | 9 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 2 | ||||
-rw-r--r-- | src/machine/machined-dbus.c | 3 |
4 files changed, 31 insertions, 15 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; diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 9a19932af4..e61ec7afd5 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2356,6 +2356,7 @@ DBusHandlerResult bus_message_filter( if (streq_ptr(path, s->scope_job)) { free(s->scope_job); s->scope_job = NULL; + session_save(s); if (s->started) { if (streq(result, "done")) @@ -2382,6 +2383,7 @@ DBusHandlerResult bus_message_filter( u->slice_job = NULL; } + user_save(u); user_add_to_gc_queue(u); } } diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 83a45b63ba..a81f37c5ca 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -116,7 +116,7 @@ static bool valid_machine_name(const char *p) { static int bus_manager_create_machine(Manager *manager, DBusMessage *message) { - const char *name, *service, *class, *slice, *root_directory; + const char *name, *service, *class, *root_directory; _cleanup_free_ char *p = NULL; DBusMessageIter iter, sub; MachineClass c; @@ -537,6 +537,7 @@ DBusHandlerResult bus_message_filter( if (streq_ptr(path, mm->scope_job)) { free(mm->scope_job); mm->scope_job = NULL; + machine_save(mm); if (mm->started) { if (streq(result, "done")) |