diff options
author | Ron Yorston <rmy@pobox.com> | 2012-04-17 11:42:11 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-04-17 11:42:11 +0100 |
commit | 8c77ef82b5e6e8c53b9d0103ae182587d5088ced (patch) | |
tree | ee4cf19b9b0e59f1d0c67b20d76d6a9b96c5ab58 /shell | |
parent | 1d1f787a7c2864149d037681badd196b363a3503 (diff) | |
download | busybox-w32-8c77ef82b5e6e8c53b9d0103ae182587d5088ced.tar.gz busybox-w32-8c77ef82b5e6e8c53b9d0103ae182587d5088ced.tar.bz2 busybox-w32-8c77ef82b5e6e8c53b9d0103ae182587d5088ced.zip |
Detect and execute shell scripts based on presence of '#!'
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c index a446a6699..109473b97 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -21,7 +21,9 @@ | |||
21 | * | 21 | * |
22 | * - Environment variables from Windows will all be turned to uppercase. | 22 | * - Environment variables from Windows will all be turned to uppercase. |
23 | * - PATH accepts both ; and : as separator, but can't be mixed | 23 | * - PATH accepts both ; and : as separator, but can't be mixed |
24 | * - command without ".exe" is still understood as executable (option to turn off?) | 24 | * - command without ".exe" extension is still understood as executable |
25 | * - shell scripts on the path are detected by the presence of '#!'; | ||
26 | * the path to the interpreter is ignored, PATH is searched to find it | ||
25 | * - both / and \ are supported in PATH. Usually you must use / | 27 | * - both / and \ are supported in PATH. Usually you must use / |
26 | * - trap/job does not work | 28 | * - trap/job does not work |
27 | * - /dev/null is supported for redirection | 29 | * - /dev/null is supported for redirection |
@@ -12951,7 +12953,16 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
12951 | if (stat(fullname, &statb) < 0) { | 12953 | if (stat(fullname, &statb) < 0) { |
12952 | if (errno != ENOENT && errno != ENOTDIR) | 12954 | if (errno != ENOENT && errno != ENOTDIR) |
12953 | e = errno; | 12955 | e = errno; |
12954 | goto loop; | 12956 | fullname[len] = '\0'; |
12957 | if (stat(fullname, &statb) < 0) { | ||
12958 | if (errno != ENOENT && errno != ENOTDIR) | ||
12959 | e = errno; | ||
12960 | goto loop; | ||
12961 | } | ||
12962 | if (!execable_file(fullname)) { | ||
12963 | e = ENOEXEC; | ||
12964 | goto loop; | ||
12965 | } | ||
12955 | } | 12966 | } |
12956 | } | 12967 | } |
12957 | fullname[len] = '\0'; | 12968 | fullname[len] = '\0'; |