mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
run0: Stay in cwd if --empower is specified without a user
If we run "run0 --empower", the expectation is to stay in the current working directory, not switch to ~.
This commit is contained in:
@@ -1098,6 +1098,12 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
|
||||
arg_exec_user = getusername_malloc();
|
||||
if (!arg_exec_user)
|
||||
return log_oom();
|
||||
|
||||
if (arg_empower && !arg_working_directory) {
|
||||
r = safe_getcwd(&arg_working_directory);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get current working directory: %m");
|
||||
}
|
||||
}
|
||||
|
||||
if (!arg_working_directory) {
|
||||
|
||||
Reference in New Issue
Block a user