went back to non-blokcing IO
[rsync/rsync.git] / io.c
diff --git a/io.c b/io.c
index 6cdbe6b..6a55576 100644 (file)
--- a/io.c
+++ b/io.c
@@ -159,6 +159,11 @@ static int read_timeout(int fd, char *buf, int len)
                        continue;
                }
 
+               if (n == -1 && 
+                   (errno == EWOULDBLOCK || errno == EAGAIN)) {
+                       continue;
+               }
+
 
                if (n == 0) {
                        if (eof_error) {
@@ -364,12 +369,17 @@ static void writefd_unbuffered(int fd,char *buf,int len)
                if (FD_ISSET(fd, &w_fds)) {
                        int ret, n = len-total;
                        
-                       ret = write(fd,buf+total,n?n:1);
+                       ret = write(fd,buf+total,n);
 
                        if (ret == -1 && errno == EINTR) {
                                continue;
                        }
 
+                       if (ret == -1 && 
+                           (errno == EWOULDBLOCK || errno == EAGAIN)) {
+                               continue;
+                       }
+
                        if (ret <= 0) {
                                rprintf(FERROR,"erroring writing %d bytes - exiting\n", len);
                                exit_cleanup(RERR_STREAMIO);