diff options
author | Rob Landley <rob@landley.net> | 2019-03-10 17:36:34 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-03-10 17:36:34 -0500 |
commit | bfd80bec14954ce2457d33dd4ce78903681c7a3a (patch) | |
tree | 347737d5b7ab38d9711f7f6bb139df7289a58605 /lib | |
parent | e9d3a2a38d4629b71de709335c22e4a9fde2ed45 (diff) | |
download | toybox-bfd80bec14954ce2457d33dd4ce78903681c7a3a.tar.gz |
Make xsendfile() variants handle -1 length properly again.
Diffstat (limited to 'lib')
-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; } |