diff options
-rw-r--r-- | lib/xwrap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c index 25ec2a53..223356b3 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -809,7 +809,7 @@ long long sendfile_len(int in, int out, long long bytes) len = bytes-total; if (bytes<0 || len>sizeof(libbuf)) len = sizeof(libbuf); - len = xread(in, libbuf, sizeof(libbuf)>(bytes-total)); + len = xread(in, libbuf, len); if (len<1) break; xwrite(out, libbuf, len); total += len; @@ -823,7 +823,7 @@ long long xsendfile_len(int in, int out, long long bytes) { long long len = sendfile_len(in, out, bytes); - if (bytes != len) error_exit("short file"); + if (bytes != -1 && bytes != len) error_exit("short file"); return len; } |