summaryrefslogtreecommitdiff
path: root/src/core/dbus-execute.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-23 11:04:34 +0200
committerDaniel Mack <github@zonque.org>2015-09-23 11:04:34 +0200
commitce40506ddb41640462f95c019fae02f14e266144 (patch)
tree40071bf0e2a93b1505eefd7471ed3bdc02d5d688 /src/core/dbus-execute.c
parent5c781d6b0dd2d5fce3cacd653ac10556e39b857b (diff)
parent602b83559a7cfcd3eee05bbdb5518830752a2667 (diff)
Merge pull request #1339 from alkino/master
Hook more properties for transient units
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r--src/core/dbus-execute.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index fd13c6d019..868c8cc05a 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -847,27 +847,36 @@ int bus_exec_context_set_transient_property(
return 1;
- } else if (streq(name, "TTYPath")) {
- const char *tty;
+ } else if (STR_IN_SET(name,
+ "TTYPath", "WorkingDirectory", "RootDirectory")) {
+ const char *s;
- r = sd_bus_message_read(message, "s", &tty);
+ r = sd_bus_message_read(message, "s", &s);
if (r < 0)
return r;
- if (!path_is_absolute(tty))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "TTY device not absolute path");
+ if (!path_is_absolute(s))
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s takes an absolute path", name);
if (mode != UNIT_CHECK) {
char *t;
- t = strdup(tty);
+ t = strdup(s);
if (!t)
return -ENOMEM;
- free(c->tty_path);
- c->tty_path = t;
+ if (streq(name, "TTYPath")) {
+ free(c->tty_path);
+ c->tty_path = t;
+ } else if (streq(name, "WorkingDirectory")) {
+ free(c->working_directory);
+ c->working_directory = t;
+ } else if (streq(name, "RootDirectory")) {
+ free(c->root_directory);
+ c->root_directory = t;
+ }
- unit_write_drop_in_private_format(u, mode, name, "TTYPath=%s\n", tty);
+ unit_write_drop_in_private_format(u, mode, name, "%s=%s\n", name, s);
}
return 1;