summaryrefslogtreecommitdiff
path: root/network_io
diff options
context:
space:
mode:
Diffstat (limited to 'network_io')
-rw-r--r--network_io/unix/sendrecv.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c
index ce6d01276..c133a26d9 100644
--- a/network_io/unix/sendrecv.c
+++ b/network_io/unix/sendrecv.c
@@ -1083,6 +1083,14 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file,
/* Update how much we sent */
*len = nbytes;
+
+ if (nbytes == 0) {
+ /* Most likely the file got smaller after the stat.
+ * Return an error so the caller can do the Right Thing.
+ */
+ return APR_EOF;
+ }
+
if ((sock->timeout > 0) && (*len < requested_len)) {
sock->options |= APR_INCOMPLETE_WRITE;
}