about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-09-02 20:19:28 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-09-02 20:19:28 +0100
commitcdbd1b258192fa27c17241877f460c5543827759 (patch)
tree936bd38b9f5165ad274d8bf3e8676e75763759f4
parentdde07f7436379f7bd8811b6252737b67b0cea94b (diff)
downloadzsh-cdbd1b258192fa27c17241877f460c5543827759.tar.gz
zsh-cdbd1b258192fa27c17241877f460c5543827759.tar.xz
zsh-cdbd1b258192fa27c17241877f460c5543827759.zip
36378: skip directories when looking for files to autoload
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cefcf7b8e..fe0457638 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 36378: Src/exec.c: skip directories when looking for autoload
+	files.
+
 2015-09-02  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 36399: Src/text.c, Test/A04redirect.ztst: shell code with
diff --git a/Src/exec.c b/Src/exec.c
index 45f1c66f0..109a04a26 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5392,7 +5392,9 @@ getfpfunc(char *s, int *ksh, char **fname)
 	}
 	unmetafy(buf, NULL);
 	if (!access(buf, R_OK) && (fd = open(buf, O_RDONLY | O_NOCTTY)) != -1) {
-	    if ((len = lseek(fd, 0, 2)) != -1) {
+	    struct stat st;
+	    if (!fstat(fd, &st) && S_ISREG(st.st_mode) &&
+		(len = lseek(fd, 0, 2)) != -1) {
 		d = (char *) zalloc(len + 1);
 		lseek(fd, 0, 0);
 		if ((rlen = read(fd, d, len)) >= 0) {