summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2009-12-16 18:39:06 +0000
committerWayne Davison <wayned@users.sourceforge.net>2009-12-16 18:39:06 +0000
commit693fd5b56e51de2910a5681533033b9530650270 (patch)
tree652a4cdfda9874c0eac0ef801a8d266528dd6af1 /Src/Modules
parent74d17bc282cb7e9e0b0d73c87aff09ecf256dda7 (diff)
downloadzsh-693fd5b56e51de2910a5681533033b9530650270.tar.gz
zsh-693fd5b56e51de2910a5681533033b9530650270.tar.xz
zsh-693fd5b56e51de2910a5681533033b9530650270.zip
Check the return value of all pipe(), read(), and write() calls.
Gets rid of all the remaining "ignoring return value" compiler
warnings, and makes some read/write operations safer by ensuring
that an EINTR is handled.
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/zftp.c10
-rw-r--r--Src/Modules/zpty.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index f637d37dc..1558d354f 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -644,7 +644,7 @@ zfgetline(char *ln, int lnsize, int tmout)
 		cmdbuf[0] = (char)IAC;
 		cmdbuf[1] = (char)DONT;
 		cmdbuf[2] = ch;
-		write(zfsess->control->fd, cmdbuf, 3);
+		write_loop(zfsess->control->fd, cmdbuf, 3);
 		continue;
 
 	    case DO:
@@ -654,7 +654,7 @@ zfgetline(char *ln, int lnsize, int tmout)
 		cmdbuf[0] = (char)IAC;
 		cmdbuf[1] = (char)WONT;
 		cmdbuf[2] = ch;
-		write(zfsess->control->fd, cmdbuf, 3);
+		write_loop(zfsess->control->fd, cmdbuf, 3);
 		continue;
 
 	    case EOF:
@@ -2754,7 +2754,7 @@ zfclose(int leaveparams)
 	if (!zfnopen) {
 	    /* Write the final status in case this is a subshell */
 	    lseek(zfstatfd, zfsessno*sizeof(int), 0);
-	    write(zfstatfd, (char *)zfstatusp+zfsessno, sizeof(int));
+	    write_loop(zfstatfd, (char *)zfstatusp+zfsessno, sizeof(int));
 
 	    close(zfstatfd);
 	    zfstatfd = -1;
@@ -3033,7 +3033,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func))
 	/* Get the status in case it was set by a forked process */
 	int oldstatus = zfstatusp[zfsessno];
 	lseek(zfstatfd, 0, 0);
-	read(zfstatfd, (char *)zfstatusp, sizeof(int)*zfsesscnt);
+	read_loop(zfstatfd, (char *)zfstatusp, sizeof(int)*zfsesscnt);
 	if (zfsess->control && (zfstatusp[zfsessno] & ZFST_CLOS)) {
 	    /* got closed in subshell without us knowing */
 	    zcfinish = 2;
@@ -3124,7 +3124,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func))
 	 * but only for the active session.
 	 */
 	lseek(zfstatfd, zfsessno*sizeof(int), 0);
-	write(zfstatfd, (char *)zfstatusp+zfsessno, sizeof(int));
+	write_loop(zfstatfd, (char *)zfstatusp+zfsessno, sizeof(int));
     }
     return ret;
 }
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 16bec2bc9..f25d442b2 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -586,7 +586,7 @@ ptyread(char *nam, Ptycmd cmd, char **args, int noblock, int mustmatch)
 	    seen = 1;
 	    if (++used == blen) {
 		if (!*args) {
-		    write(1, buf, used);
+		    write_loop(1, buf, used);
 		    used = 0;
 		} else {
 		    buf = hrealloc(buf, blen, blen << 1);
@@ -632,7 +632,7 @@ ptyread(char *nam, Ptycmd cmd, char **args, int noblock, int mustmatch)
     if (*args)
 	setsparam(*args, ztrdup(metafy(buf, used, META_HREALLOC)));
     else if (used)
-	write(1, buf, used);
+	write_loop(1, buf, used);
 
     if (seen && (!prog || matchok || !mustmatch))
 	return 0;