summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-07-11 17:21:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-07-11 17:21:26 +0000
commit6c1110da3264ca3b01cc4d80ac7b07de1f02067c (patch)
treef37fc5992f979cdc463f29d8ad0e2c3fe9ead70f
parent32d2d47fd5c71a056c93fd47069491bfeba6b25c (diff)
downloadzsh-6c1110da3264ca3b01cc4d80ac7b07de1f02067c.tar.gz
zsh-6c1110da3264ca3b01cc4d80ac7b07de1f02067c.tar.xz
zsh-6c1110da3264ca3b01cc4d80ac7b07de1f02067c.zip
12222: handle EINTR for multios helper processes
-rw-r--r--Src/exec.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index aa462de92..7896bb3a0 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1356,14 +1356,28 @@ closemn(struct multio **mfds, int fd)
 	closeallelse(mn);
 	if (mn->rflag) {
 	    /* tee process */
-	    while ((len = read(mn->pipe, buf, TCBUFSIZE)) > 0)
+	    while ((len = read(mn->pipe, buf, TCBUFSIZE)) != 0) {
+		if (len < 0) {
+		    if (errno == EINTR)
+			continue;
+		    else
+			break;
+		}
 		for (i = 0; i < mn->ct; i++)
 		    write(mn->fds[i], buf, len);
+	    }
 	} else {
 	    /* cat process */
 	    for (i = 0; i < mn->ct; i++)
-		while ((len = read(mn->fds[i], buf, TCBUFSIZE)) > 0)
+		while ((len = read(mn->fds[i], buf, TCBUFSIZE)) != 0) {
+		    if (len < 0) {
+			if (errno == EINTR)
+			    continue;
+			else
+			    break;
+		    }
 		    write(mn->pipe, buf, len);
+		}
 	}
 	_exit(0);
     }