Don't loop over read/write, recv/send or tcgetpgrp/tcsetpgrp trying

to handle EINTR.  We now use SA_RESTART with signals so this is not
needed and is potentially dangerous if it is possible to receive
SIGTTIN or SIGTTOU (which it currently is not).
This commit is contained in:
Todd C. Miller
2017-11-30 09:53:21 -07:00
parent 9298a2a42e
commit b9adb3dd51
3 changed files with 29 additions and 42 deletions

View File

@@ -73,13 +73,10 @@ errpipe_cb(int fd, int what, void *v)
* Read errno from child or EOF when command is executed.
* Note that the error pipe is *blocking*.
*/
do {
nread = read(fd, &errval, sizeof(errval));
} while (nread == -1 && errno == EINTR);
nread = read(fd, &errval, sizeof(errval));
switch (nread) {
case -1:
if (errno != EAGAIN) {
if (errno != EAGAIN && errno != EINTR) {
if (ec->cstat->val == CMD_INVALID) {
/* XXX - need a way to distinguish non-exec error. */
ec->cstat->type = CMD_ERRNO;