mirror of
https://github.com/systemd/systemd.git
synced 2025-01-23 02:04:32 +03:00
run: fix bug causing run0 to ignore -D /
.
Since the root directory was being suppressed to NULL, the subsequent check would erroneously think that no working directory was specified. This caused the default working directory to be applied instead.
This commit is contained in:
parent
6f9826b6d8
commit
0054a2acc3
@ -862,7 +862,8 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
r = parse_path_argument(optarg, true, &arg_working_directory);
|
||||
/* Root will be manually suppressed later. */
|
||||
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_working_directory);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -901,6 +902,10 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get current working directory: %m");
|
||||
}
|
||||
} else {
|
||||
/* Root was not suppressed earlier, to allow the above check to work properly. */
|
||||
if (empty_or_root(arg_working_directory))
|
||||
arg_working_directory = mfree(arg_working_directory);
|
||||
}
|
||||
|
||||
arg_service_type = "exec";
|
||||
|
Loading…
x
Reference in New Issue
Block a user