X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/a800434a82af8dbd59da7c27b382c9897dd90150..e1b3d5c4be46ee0b17a98aa48cb7cb152c4a008b:/io.c diff --git a/io.c b/io.c index 61bdc609..7909e0b1 100644 --- a/io.c +++ b/io.c @@ -108,6 +108,15 @@ static int read_timeout(int fd, char *buf, int len) continue; } + if (n == -1 && + (errno == EAGAIN || errno == EWOULDBLOCK)) { + /* this shouldn't happen, if it does then + sleep for a short time to prevent us + chewing too much CPU */ + u_sleep(100); + continue; + } + if (n == 0) { if (eof_error) { rprintf(FERROR,"EOF in read_timeout\n"); @@ -347,6 +356,15 @@ static void writefd_unbuffered(int fd,char *buf,int len) continue; } + if (ret == -1 && + (errno == EAGAIN || errno == EWOULDBLOCK)) { + /* this shouldn't happen, if it does then + sleep for a short time to prevent us + chewing too much CPU */ + u_sleep(100); + continue; + } + if (ret <= 0) { rprintf(FERROR,"erroring writing %d bytes - exiting\n", len); exit_cleanup(1);