diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-09-27 00:11:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-09-27 00:11:54 +0200 |
commit | 68372da693edb69a0881698ba9d0893bfddc9435 (patch) | |
tree | 08d1b448d7cfe46d8af5cab50fd434421c818a75 /src/systemctl | |
parent | 3fde5f30bda2a70d97f3dc8fa918e42e1c07cc2c (diff) |
systemctl: make sure set-property mangles unit names
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 8b9183dcb3..eede616e50 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3829,7 +3829,8 @@ static int append_assignment(DBusMessageIter *iter, const char *assignment) { static int set_property(DBusConnection *bus, char **args) { - _cleanup_free_ DBusMessage *m = NULL, *reply = NULL; + _cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL; + _cleanup_free_ char *n = NULL; DBusMessageIter iter, sub; dbus_bool_t runtime; DBusError error; @@ -3850,7 +3851,11 @@ static int set_property(DBusConnection *bus, char **args) { runtime = arg_runtime; - if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &args[1]) || + n = unit_name_mangle(args[1]); + if (!n) + return log_oom(); + + if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &n) || !dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &runtime) || !dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(sv)", &sub)) return log_oom(); |