mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-10-16 21:30:52 +00:00
machined: sync to /run after job completed
This commit is contained in:
+20
-12
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user