about summary refs log tree commit diff
path: root/Src/exec.c
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 /Src/exec.c
parenta554c7403a0f1b6c29e07410a03599272aeaeaee (diff)
downloadzsh-fc344465f27cdf89664a64fb157b7606c9eb837f.tar.gz
zsh-fc344465f27cdf89664a64fb157b7606c9eb837f.tar.xz
zsh-fc344465f27cdf89664a64fb157b7606c9eb837f.zip
37435 (+ fix typo): allow execution of empty files as "sh" scripts
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c3
1 files changed, 2 insertions, 1 deletions
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++)