From 693fd5b56e51de2910a5681533033b9530650270 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 16 Dec 2009 18:39:06 +0000 Subject: 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. --- Src/Modules/zftp.c | 10 +++++----- Src/Modules/zpty.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Src/Modules') 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; -- cgit v1.2.3