From bfd80bec14954ce2457d33dd4ce78903681c7a3a Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 10 Mar 2019 17:36:34 -0500 Subject: Make xsendfile() variants handle -1 length properly again. --- lib/xwrap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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; } -- cgit v1.2.3