diff options
author | Ron Yorston <rmy@pobox.com> | 2022-10-26 11:47:42 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-10-26 11:47:42 +0100 |
commit | d71cb67ff91762ae78e87440b87d7c9a160b2937 (patch) | |
tree | e378f71776199ff4fe44cb3bc020a8f43278bd2b /debianutils | |
parent | 0b5bd6e1436c38a74c5294535d5f4d7a7cf79d54 (diff) | |
download | busybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.tar.gz busybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.tar.bz2 busybox-w32-d71cb67ff91762ae78e87440b87d7c9a160b2937.zip |
win32: revert special treatment of Unix-style absolute paths
Commit 605972390 (win32: handle Unix-style absolute paths for
executables) added special treatment of paths for executables
starting with a slash. Such paths are absolute on Unix but are
relative to the current drive on Windows. On reflection this
commit did more than necessary. Later commits provided special
treatment only for paths starting with locations traditionally
used to contain binaries on Unix. This is probably sufficient.
Problems introduced by commit 605972390 include:
- If the current drive isn't the system drive tab completion of a
command starting with a slash confusingly references the system
drive.
- Building busybox-w32 with w64devkit fails on drives other than
the system drive.
Revert the changes introduced by commit 605972390.
This saves 192 bytes.
(GitHub issue #239)
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/which.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/debianutils/which.c b/debianutils/which.c index 4590653b3..b2cd4de18 100644 --- a/debianutils/which.c +++ b/debianutils/which.c | |||
@@ -12,9 +12,9 @@ | |||
12 | //config: which is used to find programs in your PATH and | 12 | //config: which is used to find programs in your PATH and |
13 | //config: print out their pathnames. | 13 | //config: print out their pathnames. |
14 | 14 | ||
15 | // NOTE: For WIN32 this applet is NOEXEC as alloc_system_drive() and | 15 | // NOTE: For WIN32 this applet is NOEXEC as alloc_ext_space() and |
16 | // find_executable() both allocate memory. And find_executable() | 16 | // find_executable() both allocate memory. And find_executable() |
17 | // calls alloc_system_drive(). | 17 | // calls alloc_ext_space(). |
18 | 18 | ||
19 | //applet:IF_PLATFORM_MINGW32(IF_WHICH(APPLET_NOEXEC(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))) | 19 | //applet:IF_PLATFORM_MINGW32(IF_WHICH(APPLET_NOEXEC(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))) |
20 | //applet:IF_PLATFORM_POSIX(IF_WHICH(APPLET_NOFORK(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))) | 20 | //applet:IF_PLATFORM_POSIX(IF_WHICH(APPLET_NOFORK(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))) |
@@ -87,7 +87,7 @@ int which_main(int argc UNUSED_PARAM, char **argv) | |||
87 | } | 87 | } |
88 | #else | 88 | #else |
89 | if (has_path(*argv)) { | 89 | if (has_path(*argv)) { |
90 | char *path = alloc_system_drive(*argv); | 90 | char *path = alloc_ext_space(*argv); |
91 | 91 | ||
92 | if (add_win32_extension(path) || file_is_executable(path)) { | 92 | if (add_win32_extension(path) || file_is_executable(path)) { |
93 | missing = 0; | 93 | missing = 0; |