From 9f2e86af0600e99cff00d1c92f9bb8d38f29896a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 1 Jul 2013 00:40:56 +0200 Subject: core: allow setting of the description string for transient units --- src/core/dbus-unit.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/core/dbus-unit.c') 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) { -- cgit v1.2.3-54-g00ecf