diff --git a/lib/xwrap.c b/lib/xwrap.c index cc320af8..6a910230 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -867,9 +867,9 @@ 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 (len == -1 || (bytes != -1 && bytes != len)) { if (out == 1 && len<0) xexit(); - error_exit("short %s", (len<0) ? "write" : "read"); + perror_exit("short %s", (len<0) ? "write" : "read"); } return len;