better error handling

This commit is contained in:
rsc 2004-04-21 22:47:01 +00:00
parent 63b6732301
commit 2b4b2ae191

View file

@ -233,8 +233,9 @@ threadread(int fd, void *a, long n)
threadfdnoblock(fd);
again:
errno = 0;
nn = read(fd, a, n);
if(nn < 0){
if(nn <= 0){
if(errno == EINTR)
goto again;
if(errno == EAGAIN || errno == EWOULDBLOCK){