1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

Merge pull request #24790 from poettering/run-chdir

run: let's make --working-directory= just work with --scope
This commit is contained in:
Yu Watanabe 2022-09-23 10:20:14 +09:00 committed by GitHub
commit 68f2134954
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -593,10 +593,6 @@ static int parse_argv(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--remain-after-exit and --service-type= are not supported in --scope mode.");
if (arg_scope && arg_working_directory)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--working-directory is not supported in --scope mode.");
if (arg_stdio != ARG_STDIO_NONE && (with_trigger || arg_scope))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"--pty/--pipe is not compatible in timer or --scope mode.");
@ -1533,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();