summaryrefslogtreecommitdiff
path: root/src/run
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-09-22 14:21:46 +0200
committerLennart Poettering <lennart@poettering.net>2022-09-22 14:22:21 +0200
commitfecc44776638a24099ce7e9ac227bcaa2c34f1e0 (patch)
tree0470556ad54abb57c416c3fc4b62efbe05d3bfd9 /src/run
parentc7b5ea69551c021a729a5d9a898a1a0d5d924bdf (diff)
downloadsystemd-fecc44776638a24099ce7e9ac227bcaa2c34f1e0.tar.gz
run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780
Diffstat (limited to 'src/run')
-rw-r--r--src/run/run.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/run/run.c b/src/run/run.c
index e2915fe4de..627a6b11da 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -1529,6 +1529,9 @@ static int start_transient_scope(sd_bus *bus) {
return log_error_errno(errno, "Failed to change UID to " UID_FMT ": %m", uid);
}
+ if (arg_working_directory && chdir(arg_working_directory) < 0)
+ return log_error_errno(errno, "Failed to change directory to '%s': %m", arg_working_directory);
+
env = strv_env_merge(environ, user_env, arg_environment);
if (!env)
return log_oom();