summaryrefslogtreecommitdiff
path: root/network_io
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2009-02-01 12:48:43 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2009-02-01 12:48:43 +0000
commit200190efabfe1e489427d133de21a923e81cea76 (patch)
treebc0bcf0a81f821813adfa761ec394b4334e66fbd /network_io
parentb089ba85b69d05582102fb1c5b336f2b0312554b (diff)
downloadlibapr-200190efabfe1e489427d133de21a923e81cea76.tar.gz
backport r739640 from trunk
apr_socket_sendfile() on Solaris: Fix handling of files truncated after the sender determines the length. (This fixes a busy loop in httpd when a file being served is truncated.) Some other implementations of apr_socket_sendfile() were already patched along the way to handle this; some apparently remain broken. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@739754 13f79535-47bb-0310-9956-ffa450edef68
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;
}