diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-08 11:38:10 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-08 11:38:10 +0000 |
commit | 5627c61f0b382593fa74757036dcd1ffbd9d9ad3 (patch) | |
tree | c41ecc5a74f986daa95b60e3936ff5e6a45567b7 /loginutils | |
parent | 0533794afd81b37684669ee0c5afc7a5e1ff159d (diff) | |
download | busybox-w32-5627c61f0b382593fa74757036dcd1ffbd9d9ad3.tar.gz busybox-w32-5627c61f0b382593fa74757036dcd1ffbd9d9ad3.tar.bz2 busybox-w32-5627c61f0b382593fa74757036dcd1ffbd9d9ad3.zip |
ash, su: add -d flag to set directory in ash, use it in su
When busybox-w32 is installed in C:/Windows/System32 su doesn't
run in the same directory as its parent as intended.
Work around this by adding a flag to the shell to set the working
directory.
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/suw32.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/loginutils/suw32.c b/loginutils/suw32.c index 3aa478f33..be1a5211e 100644 --- a/loginutils/suw32.c +++ b/loginutils/suw32.c | |||
@@ -28,6 +28,7 @@ int suw32_main(int argc UNUSED_PARAM, char **argv) | |||
28 | { | 28 | { |
29 | char *opt_command = NULL; | 29 | char *opt_command = NULL; |
30 | SHELLEXECUTEINFO info; | 30 | SHELLEXECUTEINFO info; |
31 | char *cwd; | ||
31 | 32 | ||
32 | getopt32(argv, "c:", &opt_command); | 33 | getopt32(argv, "c:", &opt_command); |
33 | if (argv[optind]) | 34 | if (argv[optind]) |
@@ -39,10 +40,12 @@ int suw32_main(int argc UNUSED_PARAM, char **argv) | |||
39 | /* info.hwnd = NULL; */ | 40 | /* info.hwnd = NULL; */ |
40 | info.lpVerb = "runas"; | 41 | info.lpVerb = "runas"; |
41 | info.lpFile = bb_busybox_exec_path; | 42 | info.lpFile = bb_busybox_exec_path; |
43 | cwd = getcwd(NULL, 0); | ||
42 | if (opt_command) | 44 | if (opt_command) |
43 | info.lpParameters = xasprintf("ash -s -c \"%s\"", opt_command); | 45 | info.lpParameters = |
46 | xasprintf("ash -d \"%s\" -s -c \"%s\"", cwd, opt_command); | ||
44 | else | 47 | else |
45 | info.lpParameters = "ash"; | 48 | info.lpParameters = xasprintf("ash -d \"%s\"", cwd); |
46 | /* info.lpDirectory = NULL; */ | 49 | /* info.lpDirectory = NULL; */ |
47 | info.nShow = SW_SHOWNORMAL; | 50 | info.nShow = SW_SHOWNORMAL; |
48 | 51 | ||