summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-12-25 00:31:32 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-12-25 00:31:32 -0800
commitfc344465f27cdf89664a64fb157b7606c9eb837f (patch)
treed67c21e5203c5aeffbd27e8736cf78a2c8aa24da
parenta554c7403a0f1b6c29e07410a03599272aeaeaee (diff)
downloadzsh-fc344465f27cdf89664a64fb157b7606c9eb837f.tar.gz
zsh-fc344465f27cdf89664a64fb157b7606c9eb837f.zip
37435 (+ fix typo): allow execution of empty files as "sh" scripts
-rw-r--r--ChangeLog3
-rw-r--r--Src/exec.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0dcb8e9d7..55d42ecb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2015-12-25 Barton E. Schaefer <schaefer@zsh.org>
+ * 37435 (+ fix typo): Src/exec.c: allow execution of empty files
+ as "sh" scripts
+
* 37434: Src/exec.c: POSIXBUILTINS "command" should prevent shell
exit on errors from special builtins
diff --git a/Src/exec.c b/Src/exec.c
index f14fc27a6..18d19b672 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -471,9 +471,10 @@ zexecve(char *pth, char **argv, char **newenvp)
if ((fd = open(pth, O_RDONLY|O_NOCTTY)) >= 0) {
argv0 = *argv;
*argv = pth;
+ execvebuf[0] = '\0';
ct = read(fd, execvebuf, POUNDBANGLIMIT);
close(fd);
- if (ct > 0) {
+ if (ct >= 0) {
if (execvebuf[0] == '#') {
if (execvebuf[1] == '!') {
for (t0 = 0; t0 != ct; t0++)