diff options
author | brian <brian@FreeBSD.org> | 2004-12-13 14:50:13 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2004-12-13 14:50:13 +0000 |
commit | ae06668733d4700e04da6deefead0e9de0862251 (patch) | |
tree | fdb6d9ed370caf08120ff488538fbc1d6b5ab3ed /usr.sbin/pppctl | |
parent | 00f132eec6515d162384e29d5cd0f46cec392141 (diff) | |
download | FreeBSD-src-ae06668733d4700e04da6deefead0e9de0862251.zip FreeBSD-src-ae06668733d4700e04da6deefead0e9de0862251.tar.gz |
Handle select() returning -1/EINTR - fairly common in these KSE days.
PR: 74972
MFC after: 3 days
Diffstat (limited to 'usr.sbin/pppctl')
-rw-r--r-- | usr.sbin/pppctl/pppctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pppctl/pppctl.c b/usr.sbin/pppctl/pppctl.c index 1ff63b3..d8e7b42 100644 --- a/usr.sbin/pppctl/pppctl.c +++ b/usr.sbin/pppctl/pppctl.c @@ -124,6 +124,7 @@ Receive(int fd, int display) char *last; fd_set f; int len; + int err; FD_ZERO(&f); FD_SET(fd, &f); @@ -133,7 +134,7 @@ Receive(int fd, int display) len = 0; while (Result = read(fd, Buffer+len, sizeof(Buffer)-len-1), Result != -1) { - if (Result == 0 && errno != EINTR) { + if (Result == 0) { Result = -1; break; } @@ -186,8 +187,11 @@ Receive(int fd, int display) len -= flush; } if ((Result = select(fd + 1, &f, NULL, NULL, &t)) <= 0) { + err = Result == -1 ? errno : 0; if (len) write(STDOUT_FILENO, Buffer, len); + if (err == EINTR) + continue; break; } } |