diff options
Diffstat (limited to 'debianutils/which.c')
-rw-r--r-- | debianutils/which.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/debianutils/which.c b/debianutils/which.c index d00b92e0b..4590653b3 100644 --- a/debianutils/which.c +++ b/debianutils/which.c | |||
@@ -93,22 +93,29 @@ int which_main(int argc UNUSED_PARAM, char **argv) | |||
93 | missing = 0; | 93 | missing = 0; |
94 | puts(bs_to_slash(path)); | 94 | puts(bs_to_slash(path)); |
95 | } | 95 | } |
96 | # if ENABLE_FEATURE_SH_STANDALONE | 96 | else if (unix_path(*argv)) { |
97 | else if (sh_standalone && unix_path(*argv)) { | ||
98 | const char *name = bb_basename(*argv); | 97 | const char *name = bb_basename(*argv); |
99 | 98 | # if ENABLE_FEATURE_SH_STANDALONE | |
100 | if (find_applet_by_name(name) >= 0) { | 99 | if (sh_standalone && find_applet_by_name(name) >= 0) { |
101 | missing = 0; | 100 | missing = 0; |
102 | puts(name); | 101 | puts(name); |
102 | } else | ||
103 | # endif | ||
104 | { | ||
105 | argv[0] = (char *)name; | ||
106 | free(path); | ||
107 | goto try_PATH; | ||
103 | } | 108 | } |
104 | } | 109 | } |
105 | # endif | ||
106 | free(path); | 110 | free(path); |
107 | #endif | 111 | #endif |
108 | } else { | 112 | } else { |
109 | char *path; | 113 | char *path; |
110 | char *p; | 114 | char *p; |
111 | 115 | ||
116 | #if ENABLE_PLATFORM_MINGW32 | ||
117 | try_PATH: | ||
118 | #endif | ||
112 | path = env_path; | 119 | path = env_path; |
113 | /* NOFORK NB: xmalloc inside find_executable(), must have no allocs above! */ | 120 | /* NOFORK NB: xmalloc inside find_executable(), must have no allocs above! */ |
114 | while ((p = find_executable(*argv, &path)) != NULL) { | 121 | while ((p = find_executable(*argv, &path)) != NULL) { |