aboutsummaryrefslogtreecommitdiff
path: root/debianutils/which.c
diff options
context:
space:
mode:
Diffstat (limited to 'debianutils/which.c')
-rw-r--r--debianutils/which.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index b2cd4de18..4af6daf4f 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -12,9 +12,8 @@
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_ext_space() and 15// NOTE: For WIN32 this applet is NOEXEC as file_is_win32_exe() and
16// find_executable() both allocate memory. And find_executable() 16// find_executable() both allocate memory.
17// calls alloc_ext_space().
18 17
19//applet:IF_PLATFORM_MINGW32(IF_WHICH(APPLET_NOEXEC(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))) 18//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))) 19//applet:IF_PLATFORM_POSIX(IF_WHICH(APPLET_NOFORK(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which)))
@@ -87,9 +86,9 @@ int which_main(int argc UNUSED_PARAM, char **argv)
87 } 86 }
88#else 87#else
89 if (has_path(*argv)) { 88 if (has_path(*argv)) {
90 char *path = alloc_ext_space(*argv); 89 char *path = file_is_win32_exe(*argv);
91 90
92 if (add_win32_extension(path) || file_is_executable(path)) { 91 if (path) {
93 missing = 0; 92 missing = 0;
94 puts(bs_to_slash(path)); 93 puts(bs_to_slash(path));
95 } 94 }
@@ -103,11 +102,9 @@ int which_main(int argc UNUSED_PARAM, char **argv)
103# endif 102# endif
104 { 103 {
105 argv[0] = (char *)name; 104 argv[0] = (char *)name;
106 free(path);
107 goto try_PATH; 105 goto try_PATH;
108 } 106 }
109 } 107 }
110 free(path);
111#endif 108#endif
112 } else { 109 } else {
113 char *path; 110 char *path;