Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 73540 invoked from network); 13 Mar 2006 19:58:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Mar 2006 19:58:04 -0000 Received: (qmail 94285 invoked by uid 500); 13 Mar 2006 19:58:04 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 94244 invoked by uid 500); 13 Mar 2006 19:58:03 -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 94233 invoked by uid 99); 13 Mar 2006 19:58:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Mar 2006 11:58:03 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 13 Mar 2006 11:58:03 -0800 Received: (qmail 73418 invoked by uid 65534); 13 Mar 2006 19:57:42 -0000 Message-ID: <20060313195742.73417.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r385640 - /apr/apr/branches/1.2.x/file_io/win32/readwrite.c Date: Mon, 13 Mar 2006 19:57:42 -0000 To: commits@apr.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: wrowe Date: Mon Mar 13 11:57:40 2006 New Revision: 385640 URL: http://svn.apache.org/viewcvs?rev=385640&view=rev Log: Refactor the win32 apr_file_gets logic to close a newly uncovered bug following the fix to the flush logic. Man this code is suboptimal... Modified: apr/apr/branches/1.2.x/file_io/win32/readwrite.c Modified: apr/apr/branches/1.2.x/file_io/win32/readwrite.c URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/file_io/win32/readwrite.c?rev=385640&r1=385639&r2=385640&view=diff ============================================================================== --- apr/apr/branches/1.2.x/file_io/win32/readwrite.c (original) +++ apr/apr/branches/1.2.x/file_io/win32/readwrite.c Mon Mar 13 11:57:40 2006 @@ -434,8 +434,13 @@ readlen = 1; rv = apr_file_read(thefile, str+i, &readlen); - if (readlen != 1) { - rv = APR_EOF; + if (rv != APR_SUCCESS && rv != APR_EOF) + return rv; + + if (readlen == 0) { + /* If we have bytes, defer APR_EOF to the next call */ + if (i > 0) + rv = APR_SUCCESS; break; } @@ -445,12 +450,6 @@ } } str[i] = 0; - if (i > 0) { - /* we stored chars; don't report EOF or any other errors; - * the app will find out about that on the next call - */ - return APR_SUCCESS; - } return rv; }