diff options
-rw-r--r-- | lib/portability.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/portability.c b/lib/portability.c index 0c364c29..f3c3c251 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -622,12 +622,13 @@ long long sendfile_len(int in, int out, long long bytes, long long *consumed) len = bytes-total; if (bytes<0 || len>sizeof(libbuf)) len = sizeof(libbuf); + errno = 0; #if CFG_TOYBOX_COPYFILERANGE len = copy_file_range(in, 0, out, 0, bytes, 0); #else ww = len = read(in, libbuf, len); #endif - if (!len && errno==EAGAIN) continue; + if (len<1 && errno==EAGAIN) continue; if (len<1) break; if (consumed) *consumed += len; if (ww && writeall(out, libbuf, len) != len) return -1; |