aboutsummaryrefslogtreecommitdiff
path: root/debianutils/which.c
diff options
context:
space:
mode:
Diffstat (limited to 'debianutils/which.c')
-rw-r--r--debianutils/which.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 23a481438..fbfd19cdc 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -12,7 +12,7 @@
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//applet:IF_WHICH(APPLET(which, BB_DIR_USR_BIN, BB_SUID_DROP)) 15//applet:IF_WHICH(APPLET_NOFORK(which, which, BB_DIR_USR_BIN, BB_SUID_DROP, which))
16 16
17//kbuild:lib-$(CONFIG_WHICH) += which.o 17//kbuild:lib-$(CONFIG_WHICH) += which.o
18 18
@@ -37,8 +37,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
37 if (!env_path) 37 if (!env_path)
38 env_path = bb_default_root_path; 38 env_path = bb_default_root_path;
39 39
40 opt_complementary = "-1"; /* at least one argument */ 40 getopt32(argv, "^" "a" "\0" "-1"/*at least one arg*/);
41 getopt32(argv, "a");
42 argv += optind; 41 argv += optind;
43 42
44 do { 43 do {
@@ -73,6 +72,8 @@ int which_main(int argc UNUSED_PARAM, char **argv)
73 char *tmp; 72 char *tmp;
74 73
75 path = tmp = xstrdup(env_path); 74 path = tmp = xstrdup(env_path);
75//NOFORK FIXME: nested xmallocs (one is inside find_executable())
76//can leak memory on failure
76 while ((p = find_executable(*argv, &tmp)) != NULL) { 77 while ((p = find_executable(*argv, &tmp)) != NULL) {
77 missing = 0; 78 missing = 0;
78 puts(p); 79 puts(p);