From cdbd1b258192fa27c17241877f460c5543827759 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 2 Sep 2015 20:19:28 +0100 Subject: 36378: skip directories when looking for files to autoload --- Src/exec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Src/exec.c') 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) { -- cgit 1.4.1