about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-04-06 09:25:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-04-06 09:25:17 +0000
commit6fa6a1f865b56b1dee05d780c788686db3bd3c2a (patch)
treea1c5b3279db9601e348222f006b5ac0b9b45d382 /Src/exec.c
parent4688564c0a891a2e3fa73255cf907dd269a62a2e (diff)
downloadzsh-6fa6a1f865b56b1dee05d780c788686db3bd3c2a.tar.gz
zsh-6fa6a1f865b56b1dee05d780c788686db3bd3c2a.tar.xz
zsh-6fa6a1f865b56b1dee05d780c788686db3bd3c2a.zip
Peter Castro: Cygwin improvements for dynamic libraries, text/binary, paths
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 4bd6503bf..8256910b3 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3662,6 +3662,7 @@ getfpfunc(char *s, int *ksh)
 {
     char **pp, buf[PATH_MAX];
     off_t len;
+    off_t rlen;
     char *d;
     Eprog r;
     int fd;
@@ -3681,12 +3682,12 @@ getfpfunc(char *s, int *ksh)
 	    if ((len = lseek(fd, 0, 2)) != -1) {
 		d = (char *) zalloc(len + 1);
 		lseek(fd, 0, 0);
-		if (read(fd, d, len) == len) {
+		if ((rlen = read(fd, d, len)) >= 0) {
 		    char *oldscriptname = scriptname;
 
 		    close(fd);
-		    d[len] = '\0';
-		    d = metafy(d, len, META_REALLOC);
+		    d[rlen] = '\0';
+		    d = metafy(d, rlen, META_REALLOC);
 
 		    scriptname = dupstring(s);
 		    r = parse_string(d);