aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/xwrap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index e4f8f013..817037db 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -832,8 +832,10 @@ long long xsendfile_len(int in, int out, long long bytes)
{
long long len = sendfile_len(in, out, bytes, 0);
- if (bytes != -1 && bytes != len)
+ if (bytes != -1 && bytes != len) {
+ if (out == 1 && len<0) xexit();
error_exit("short %s", (len<0) ? "write" : "read");
+ }
return len;
}