summaryrefslogtreecommitdiffstats
path: root/src/run/run.c
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/run.c
parentRevert "systemd-run: refuse --working-directory option with --scope" (diff)
downloadsystemd-fecc44776638a24099ce7e9ac227bcaa2c34f1e0.tar.xz
systemd-fecc44776638a24099ce7e9ac227bcaa2c34f1e0.zip
run: make --working-directory= work for --scope too
This sounds like a more user-friendly alternative to #24780
Diffstat (limited to '')
-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();