diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-07-10 21:13:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-07-10 23:41:03 +0200 |
commit | b9316fb0f39fff3df792e4e72eb491ec4265b91f (patch) | |
tree | 02e7580a03b446c4cd5e9b52246a1efba7cc7567 /src/core/dbus-unit.c | |
parent | 71445ae75b0e9954d141e5f0ee97803b406ea332 (diff) |
unit: save description/slice of transient units to /run
This is necessary so that these properties survive a daemon reload.
Diffstat (limited to 'src/core/dbus-unit.c')
-rw-r--r-- | src/core/dbus-unit.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 4605b2fe07..e07a28e32d 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -794,6 +794,7 @@ static int bus_unit_set_transient_property( return -EINVAL; if (mode != UNIT_CHECK) { + _cleanup_free_ char *contents = NULL; const char *description; dbus_message_iter_get_basic(i, &description); @@ -801,6 +802,12 @@ static int bus_unit_set_transient_property( r = unit_set_description(u, description); if (r < 0) return r; + + contents = strjoin("[Unit]\nDescription=", description, "\n", NULL); + if (!contents) + return -ENOMEM; + + unit_write_drop_in(u, mode, "Description", contents); } return 1; @@ -818,6 +825,8 @@ static int bus_unit_set_transient_property( if (mode != UNIT_CHECK) unit_ref_unset(&u->slice); } else { + _cleanup_free_ char *contents = NULL; + r = manager_load_unit(u->manager, s, NULL, error, &slice); if (r < 0) return r; @@ -827,6 +836,12 @@ static int bus_unit_set_transient_property( if (mode != UNIT_CHECK) unit_ref_set(&u->slice, slice); + + contents = strjoin("[", UNIT_VTABLE(u)->private_section, "]\nSlice=", s, NULL); + if (!contents) + return -ENOMEM; + + unit_write_drop_in(u, mode, "Slice", contents); } return 1; } |