From 6c1110da3264ca3b01cc4d80ac7b07de1f02067c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 11 Jul 2000 17:21:26 +0000 Subject: 12222: handle EINTR for multios helper processes --- Src/exec.c | 18 ++++++++++++++++-- 1 file 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); } -- cgit 1.4.1