diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-02 20:16:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-02 20:16:18 +0100 |
commit | 5732a7dbb0efa79cc36c6864a4af2e98685b53d6 (patch) | |
tree | 9f2d3e9f7a5f489eca92b4a39af543c810caac35 /src/shared | |
parent | 3e66a83cc34a5f201e3afa831c7ad8bc22a8549f (diff) | |
parent | dcebcd7ade39f4137a34dd08991432f8df995867 (diff) |
Merge pull request #1690 from evverx/run-runtime-directory
systemd-run can launch units with RuntimeDirectory
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bus-util.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index dbae6e7c85..a13991a960 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -1789,6 +1789,40 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen r = sd_bus_message_close_container(m); + } else if (streq(field, "RuntimeDirectory")) { + const char *p; + + r = sd_bus_message_open_container(m, 'v', "as"); + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_message_open_container(m, 'a', "s"); + if (r < 0) + return bus_log_create_error(r); + + p = eq; + + for (;;) { + _cleanup_free_ char *word = NULL; + + r = extract_first_word(&p, &word, NULL, EXTRACT_QUOTES); + if (r < 0) + return log_error_errno(r, "Failed to parse %s value %s", field, eq); + + if (r == 0) + break; + + r = sd_bus_message_append_basic(m, 's', word); + if (r < 0) + return bus_log_create_error(r); + } + + r = sd_bus_message_close_container(m); + if (r < 0) + return bus_log_create_error(r); + + r = sd_bus_message_close_container(m); + } else { log_error("Unknown assignment %s.", assignment); return -EINVAL; |