diff options
author | Ron Yorston <rmy@pobox.com> | 2017-08-22 14:56:12 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2017-08-22 14:56:12 +0100 |
commit | ce9af1cc5ea23f754587448cf35b5120c77bfeef (patch) | |
tree | 69e5eaba5e75ab909ed92d5045393471b8ff3c13 /debianutils/which.c | |
parent | c170026700eabb10147dd848c45c06995b43a32e (diff) | |
parent | e837a0dbbebf4229306df98fe9ee3b9bb30630c4 (diff) | |
download | busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.tar.gz busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.tar.bz2 busybox-w32-ce9af1cc5ea23f754587448cf35b5120c77bfeef.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'debianutils/which.c')
-rw-r--r-- | debianutils/which.c | 7 |
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); |