aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-12-20 06:10:35 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-12-20 06:10:35 +0100
commit83f103b30e41ab038e45661df97625f655abe491 (patch)
tree2ae327d0bfa34508dcaaaa0fc42b3ea5cb497aed
parent3365e9f3cc1859e8c427533e13676740d8038719 (diff)
downloadbusybox-w32-83f103b30e41ab038e45661df97625f655abe491.tar.gz
busybox-w32-83f103b30e41ab038e45661df97625f655abe491.tar.bz2
busybox-w32-83f103b30e41ab038e45661df97625f655abe491.zip
ash: in standalone mode, search in $PATH if /proc/self/exe doesn't exist
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index b4ed8e578..d197fa19a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -7471,9 +7471,7 @@ shellexec(char **argv, const char *path, int idx)
7471 int e; 7471 int e;
7472 char **envp; 7472 char **envp;
7473 int exerrno; 7473 int exerrno;
7474#if ENABLE_FEATURE_SH_STANDALONE 7474 int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */
7475 int applet_no = -1;
7476#endif
7477 7475
7478 clearredir(/*drop:*/ 1); 7476 clearredir(/*drop:*/ 1);
7479 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL); 7477 envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL);
@@ -7483,8 +7481,16 @@ shellexec(char **argv, const char *path, int idx)
7483#endif 7481#endif
7484 ) { 7482 ) {
7485 tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp); 7483 tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) argv[0], argv, envp);
7484 if (applet_no >= 0) {
7485 /* We tried execing ourself, but it didn't work.
7486 * Maybe /proc/self/exe doesn't exist?
7487 * Try $PATH search.
7488 */
7489 goto try_PATH;
7490 }
7486 e = errno; 7491 e = errno;
7487 } else { 7492 } else {
7493 try_PATH:
7488 e = ENOENT; 7494 e = ENOENT;
7489 while ((cmdname = path_advance(&path, argv[0])) != NULL) { 7495 while ((cmdname = path_advance(&path, argv[0])) != NULL) {
7490 if (--idx < 0 && pathopt == NULL) { 7496 if (--idx < 0 && pathopt == NULL) {