aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/rc
diff options
context:
space:
mode:
authorMichael Teichgräber <mt4swm@googlemail.com>2009-08-23 13:25:44 -0400
committerMichael Teichgräber <mt4swm@googlemail.com>2009-08-23 13:25:44 -0400
commite066b12927b496c9f3b442a5928bacfb48e6334e (patch)
tree48a4c13cdd8a6ecc021129169fa72f0e895ee1ad /src/cmd/rc
parent375b78fb110b7e1dd3686bc43aba38cf45c606e9 (diff)
downloadplan9port-e066b12927b496c9f3b442a5928bacfb48e6334e.tar.gz
plan9port-e066b12927b496c9f3b442a5928bacfb48e6334e.tar.bz2
plan9port-e066b12927b496c9f3b442a5928bacfb48e6334e.zip
rc: make read not ignore interrupts/errors (again)
http://codereview.appspot.com/110042
Diffstat (limited to 'src/cmd/rc')
-rw-r--r--src/cmd/rc/unixcrap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cmd/rc/unixcrap.c b/src/cmd/rc/unixcrap.c
index d71cbc38..9393fb23 100644
--- a/src/cmd/rc/unixcrap.c
+++ b/src/cmd/rc/unixcrap.c
@@ -222,8 +222,11 @@ readnb(int fd, char *buf, long cnt)
int flgs;
didreset = 0;
- while((n = read(fd, buf, cnt)) == -1)
- if(!didreset && errno == EAGAIN){
+again:
+ n = read(fd, buf, cnt);
+ if(n == -1)
+ if(errno == EAGAIN){
+ if(!didreset){
if((flgs = fcntl(fd, F_GETFL, 0)) == -1)
return -1;
flgs &= ~O_NONBLOCK;
@@ -231,6 +234,8 @@ readnb(int fd, char *buf, long cnt)
return -1;
didreset = 1;
}
+ goto again;
+ }
return n;
}