Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 32339 invoked from network); 31 Jan 2009 22:12:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2009 22:12:33 -0000 Received: (qmail 79280 invoked by uid 500); 31 Jan 2009 22:12:32 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 79266 invoked by uid 500); 31 Jan 2009 22:12:32 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 79257 invoked by uid 99); 31 Jan 2009 22:12:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jan 2009 14:12:32 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 31 Jan 2009 22:12:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 053822388896; Sat, 31 Jan 2009 22:12:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r739640 - in /apr/apr/trunk: CHANGES network_io/unix/sendrecv.c Date: Sat, 31 Jan 2009 22:12:11 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090131221212.053822388896@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }