diff options
author | Ron Yorston <rmy@pobox.com> | 2024-10-08 11:54:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-10-08 12:09:30 +0100 |
commit | ded78ca2656fd41f130d65345b0eb4d39b1fcbdf (patch) | |
tree | ec6a2dfab77f2a49a9629d29df371a3d93256929 /debianutils | |
parent | 054f494916093715bc1d2d25a7a452a036d41add (diff) | |
parent | 75ca8d074bacb6896d770993b93161c40aa31b9f (diff) | |
download | busybox-w32-ded78ca2656fd41f130d65345b0eb4d39b1fcbdf.tar.gz busybox-w32-ded78ca2656fd41f130d65345b0eb4d39b1fcbdf.tar.bz2 busybox-w32-ded78ca2656fd41f130d65345b0eb4d39b1fcbdf.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'debianutils')
-rw-r--r-- | debianutils/which.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/debianutils/which.c b/debianutils/which.c index fd3f53d3e..5d564e01d 100644 --- a/debianutils/which.c +++ b/debianutils/which.c | |||
@@ -35,10 +35,8 @@ | |||
35 | int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 35 | int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
36 | int which_main(int argc UNUSED_PARAM, char **argv) | 36 | int which_main(int argc UNUSED_PARAM, char **argv) |
37 | { | 37 | { |
38 | char *env_path; | 38 | const char *env_path; |
39 | int status = 0; | 39 | int status = 0; |
40 | /* This sizeof(): bb_default_root_path is shorter than BB_PATH_ROOT_PATH */ | ||
41 | char buf[sizeof(BB_PATH_ROOT_PATH)]; | ||
42 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE | 40 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE |
43 | /* 'Which' in argv[0] indicates we were run from a standalone shell */ | 41 | /* 'Which' in argv[0] indicates we were run from a standalone shell */ |
44 | int sh_standalone = argv[0][0] == 'W'; | 42 | int sh_standalone = argv[0][0] == 'W'; |
@@ -46,8 +44,7 @@ int which_main(int argc UNUSED_PARAM, char **argv) | |||
46 | 44 | ||
47 | env_path = getenv("PATH"); | 45 | env_path = getenv("PATH"); |
48 | if (!env_path) | 46 | if (!env_path) |
49 | /* env_path must be writable, and must not alloc, so... */ | 47 | env_path = bb_default_root_path; |
50 | env_path = strcpy(buf, bb_default_root_path); | ||
51 | 48 | ||
52 | getopt32(argv, "^" "a" "\0" "-1"/*at least one arg*/); | 49 | getopt32(argv, "^" "a" "\0" "-1"/*at least one arg*/); |
53 | argv += optind; | 50 | argv += optind; |
@@ -94,7 +91,7 @@ int which_main(int argc UNUSED_PARAM, char **argv) | |||
94 | } | 91 | } |
95 | #endif | 92 | #endif |
96 | } else { | 93 | } else { |
97 | char *path; | 94 | const char *path; |
98 | char *p; | 95 | char *p; |
99 | 96 | ||
100 | #if ENABLE_PLATFORM_MINGW32 | 97 | #if ENABLE_PLATFORM_MINGW32 |