aboutsummaryrefslogtreecommitdiff
path: root/sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'sh.c')
-rw-r--r--sh.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sh.c b/sh.c
index cc0d78687..87c37caa9 100644
--- a/sh.c
+++ b/sh.c
@@ -67,7 +67,6 @@
67static const int MAX_LINE = 256; /* size of input buffer for cwd data */ 67static const int MAX_LINE = 256; /* size of input buffer for cwd data */
68static const int MAX_READ = 128; /* size of input buffer for `read' builtin */ 68static const int MAX_READ = 128; /* size of input buffer for `read' builtin */
69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 69#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
70extern size_t NUM_APPLETS;
71 70
72 71
73enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE, 72enum redir_type { REDIRECT_INPUT, REDIRECT_OVERWRITE,
@@ -1371,7 +1370,8 @@ static int pseudo_exec(struct child_prog *child)
1371{ 1370{
1372 struct built_in_command *x; 1371 struct built_in_command *x;
1373#ifdef BB_FEATURE_SH_STANDALONE_SHELL 1372#ifdef BB_FEATURE_SH_STANDALONE_SHELL
1374 struct BB_applet search_applet, *applet; 1373 struct BB_applet *applet;
1374 const char *name;
1375#endif 1375#endif
1376 1376
1377 /* Check if the command matches any of the non-forking builtins. 1377 /* Check if the command matches any of the non-forking builtins.
@@ -1404,7 +1404,7 @@ static int pseudo_exec(struct child_prog *child)
1404 * /bin/foo invocation will fork and exec /bin/foo, even if 1404 * /bin/foo invocation will fork and exec /bin/foo, even if
1405 * /bin/foo is a symlink to busybox. 1405 * /bin/foo is a symlink to busybox.
1406 */ 1406 */
1407 search_applet.name = child->argv[0]; 1407 name = child->argv[0];
1408 1408
1409#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN 1409#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
1410 /* If you enable BB_FEATURE_SH_APPLETS_ALWAYS_WIN, then 1410 /* If you enable BB_FEATURE_SH_APPLETS_ALWAYS_WIN, then
@@ -1412,13 +1412,11 @@ static int pseudo_exec(struct child_prog *child)
1412 * /bin/cat exists on the filesystem and is _not_ busybox. 1412 * /bin/cat exists on the filesystem and is _not_ busybox.
1413 * Some systems want this, others do not. Choose wisely. :-) 1413 * Some systems want this, others do not. Choose wisely. :-)
1414 */ 1414 */
1415 search_applet.name = get_last_path_component(search_applet.name); 1415 name = get_last_path_component(name);
1416#endif 1416#endif
1417 1417
1418 /* Do a binary search to find the applet entry given the name. */ 1418 /* Do a binary search to find the applet entry given the name. */
1419 applet = bsearch(&search_applet, applets, NUM_APPLETS, 1419 if ((applet = find_applet_by_name(name)) != NULL) {
1420 sizeof(struct BB_applet), applet_name_compare);
1421 if (applet != NULL) {
1422 int argc_l; 1420 int argc_l;
1423 char** argv=child->argv; 1421 char** argv=child->argv;
1424 for(argc_l=0;*argv!=NULL; argv++, argc_l++); 1422 for(argc_l=0;*argv!=NULL; argv++, argc_l++);