diff options
Diffstat (limited to 'common/sys/net.c')
-rw-r--r-- | common/sys/net.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/sys/net.c b/common/sys/net.c index efeda16a..5bf9dc5e 100644 --- a/common/sys/net.c +++ b/common/sys/net.c @@ -189,9 +189,9 @@ int toread(int fd, void *buf, int len) int l; for( l = 0 ; len > 0 ; ) if( (l = read(fd, buf, len)) <= 0 ) { - if (errno == EINTR || errno == EAGAIN) + if (l < 0 && (errno == EINTR || errno == EAGAIN)) continue; - return -1; + return l; }else{ buf += l; len -= l; @@ -207,9 +207,9 @@ int towrite(int fd, const void *buf, int len) int l; for( l = 0 ; len > 0 ; ) if( (l = write(fd, buf, len)) <= 0){ - if (errno == EINTR || errno == EAGAIN) + if (l < 0 && (errno == EINTR || errno == EAGAIN)) continue; - return -1; + return l; }else{ buf += l; len -= l; |