1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

12222: handle EINTR for multios helper processes

This commit is contained in:
Peter Stephenson 2000-07-11 17:21:26 +00:00
parent 32d2d47fd5
commit 6c1110da32

@ -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);
}