summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-07-01 00:40:56 +0200
committerLennart Poettering <lennart@poettering.net>2013-07-01 00:40:56 +0200
commit9f2e86af0600e99cff00d1c92f9bb8d38f29896a (patch)
tree92a08a391007eb6eb4731b474375652227917e78 /src/core
parent6c12b52e19640747e96f89d85422941a23dc6b29 (diff)
core: allow setting of the description string for transient units
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-scope.c4
-rw-r--r--src/core/dbus-service.c4
-rw-r--r--src/core/dbus-unit.c33
3 files changed, 37 insertions, 4 deletions
diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c
index 1497b76761..604d147945 100644
--- a/src/core/dbus-scope.c
+++ b/src/core/dbus-scope.c
@@ -76,7 +76,7 @@ DBusHandlerResult bus_scope_message_handler(Unit *u, DBusConnection *c, DBusMess
return bus_default_message_handler(c, message, INTROSPECTION, INTERFACES_LIST, bps);
}
-static int bus_scope_set_transient_properties(
+static int bus_scope_set_transient_property(
Scope *s,
const char *name,
DBusMessageIter *i,
@@ -146,7 +146,7 @@ int bus_scope_set_property(
if (u->load_state == UNIT_STUB) {
/* While we are created we still accept PIDs */
- r = bus_scope_set_transient_properties(s, name, i, mode, error);
+ r = bus_scope_set_transient_property(s, name, i, mode, error);
if (r != 0)
return r;
}
diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c
index e5e95a1ab9..3bedda6c01 100644
--- a/src/core/dbus-service.c
+++ b/src/core/dbus-service.c
@@ -165,7 +165,7 @@ DBusHandlerResult bus_service_message_handler(Unit *u, DBusConnection *connectio
return bus_default_message_handler(connection, message, INTROSPECTION, INTERFACES_LIST, bps);
}
-static int bus_service_set_transient_properties(
+static int bus_service_set_transient_property(
Service *s,
const char *name,
DBusMessageIter *i,
@@ -304,7 +304,7 @@ int bus_service_set_property(
if (u->transient && u->load_state == UNIT_STUB) {
/* This is a transient unit, let's load a little more */
- r = bus_service_set_transient_properties(s, name, i, mode, error);
+ r = bus_service_set_transient_property(s, name, i, mode, error);
if (r != 0)
return r;
}
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) {