while (len > 0) {
r = read (fd, buf, len);
- if (r == -1)
+ if (r == -1) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
return -1;
+ }
buf += r;
len -= r;
}
if (n == -1) {
- if (errno != EAGAIN)
+ if (errno != EINTR && errno != EAGAIN)
perrorf (g, "read");
return;
}
return;
if (n == -1) {
- if (errno != EAGAIN)
+ if (errno != EINTR && errno != EAGAIN)
perrorf (g, "read");
return;
}
}
/* Send file in chunked encoding. */
- while (!cancel && (r = read (fd, buf, sizeof buf)) > 0) {
+ while (!cancel) {
+ r = read (fd, buf, sizeof buf);
+ if (r == -1 && (errno == EINTR || errno == EAGAIN))
+ continue;
+ if (r <= 0) break;
err = send_file_data_sync (g, buf, r);
if (err < 0) {
if (err == -2) /* daemon sent cancellation */