mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
run0: support --chdir='~' for switching to target user's home dir
parse_path_argument() unconditionally makes the passed path absolute, without handling '~' of any sort. I think this generally makes sense in most tools, since ~ expansion is typically done by the shell and we wouldn't be seeing them in the first place and hence special casing is not worth it. But in run0 let's explicit enable '~'.
This commit is contained in:
@@ -924,8 +924,11 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
/* Root will be manually suppressed later. */
|
||||
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_working_directory);
|
||||
if (streq(optarg, "~"))
|
||||
r = free_and_strdup_warn(&arg_working_directory, optarg);
|
||||
else
|
||||
/* Root will be manually suppressed later. */
|
||||
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_working_directory);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user