diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-07-01 00:40:56 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-07-01 00:40:56 +0200 |
commit | 9f2e86af0600e99cff00d1c92f9bb8d38f29896a (patch) | |
tree | 92a08a391007eb6eb4731b474375652227917e78 /src/core/dbus-unit.c | |
parent | 6c12b52e19640747e96f89d85422941a23dc6b29 (diff) |
core: allow setting of the description string for transient units
Diffstat (limited to 'src/core/dbus-unit.c')
-rw-r--r-- | src/core/dbus-unit.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index f518505750..36c3abdb97 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -764,6 +764,37 @@ oom: return DBUS_HANDLER_RESULT_NEED_MEMORY; } +static int bus_unit_set_transient_property( + Unit *u, + const char *name, + DBusMessageIter *i, + UnitSetPropertiesMode mode, + DBusError *error) { + + int r; + + assert(u); + assert(name); + 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); + + r = unit_set_description(u, description); + if (r < 0) + return r; + + return 1; + } + + return 0; +} + int bus_unit_set_properties( Unit *u, DBusMessageIter *iter, @@ -823,6 +854,8 @@ int bus_unit_set_properties( dbus_message_iter_recurse(&sub2, &sub3); r = UNIT_VTABLE(u)->bus_set_property(u, name, &sub3, for_real ? mode : UNIT_CHECK, error); + if (r == 0 && u->transient && u->load_state == UNIT_STUB) + r = bus_unit_set_transient_property(u, name, &sub3, for_real ? mode : UNIT_CHECK, error); if (r < 0) return r; if (r == 0) { |