apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r739640 - in /apr/apr/trunk: CHANGES network_io/unix/sendrecv.c
Date Sat, 31 Jan 2009 22:12:11 GMT
Author: trawick
Date: Sat Jan 31 22:12:11 2009
New Revision: 739640

URL: http://svn.apache.org/viewvc?rev=739640&view=rev
Log:
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.


Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/network_io/unix/sendrecv.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=739640&r1=739639&r2=739640&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Sat Jan 31 22:12:11 2009
@@ -1,4 +1,10 @@
                                                      -*- coding: utf-8 -*-
+Changes for APR 2.0.0
+
+  *) 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.)  [Jeff Trawick]
+
 Changes for APR 1.4.0
 
   *) Win32: Do not error out on apr_pollset_poll() when there are no sockets.

Modified: apr/apr/trunk/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sendrecv.c?rev=739640&r1=739639&r2=739640&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sendrecv.c (original)
+++ apr/apr/trunk/network_io/unix/sendrecv.c Sat Jan 31 22:12:11 2009
@@ -1083,6 +1083,14 @@
 
     /* 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;
     }



Mime
View raw message