From 56ce7d35c2affb367045c929a3aeae5a2f8d1d28 Mon Sep 17 00:00:00 2001 From: nick Date: Wed, 6 Feb 2013 14:41:49 +0000 Subject: [PATCH] Add a debug message for cases where sendfile() fails --- src/ioutil.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ioutil.c b/src/ioutil.c index e6a61f9..9aac41f 100644 --- a/src/ioutil.c +++ b/src/ioutil.c @@ -148,7 +148,10 @@ int sendfileloop(int out_fd, int in_fd, off64_t *offset, size_t count) ssize_t result = sendfile64(out_fd, in_fd, offset, count-sent); debug("sendfile64(out_fd=%d, in_fd=%d, offset=%p, count-sent=%ld) = %ld", out_fd, in_fd, offset, count-sent, result); - if (result == -1) { return -1; } + if (result == -1) { + debug( "%s (%i) calling sendfile64()", strerror(errno), errno ); + return -1; + } sent += result; debug("sent=%ld, count=%ld", sent, count); }