diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-09-22 14:21:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-09-22 14:22:21 +0200 |
commit | fecc44776638a24099ce7e9ac227bcaa2c34f1e0 (patch) | |
tree | 0470556ad54abb57c416c3fc4b62efbe05d3bfd9 /src/run/run.c | |
parent | Revert "systemd-run: refuse --working-directory option with --scope" (diff) | |
download | systemd-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.c | 3 |
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(); |