apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r385641 - /apr/apr/trunk/file_io/win32/readwrite.c
Date Mon, 13 Mar 2006 19:58:23 GMT
Author: wrowe
Date: Mon Mar 13 11:58:22 2006
New Revision: 385641

URL: http://svn.apache.org/viewcvs?rev=385641&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...

Forward-port 385640 [whoops, ment to apply this in opposite order]

Modified:
    apr/apr/trunk/file_io/win32/readwrite.c

Modified: apr/apr/trunk/file_io/win32/readwrite.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/win32/readwrite.c?rev=385641&r1=385640&r2=385641&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/readwrite.c (original)
+++ apr/apr/trunk/file_io/win32/readwrite.c Mon Mar 13 11:58:22 2006
@@ -440,8 +440,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;
         }
         
@@ -451,12 +456,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;
 }
 



Mime
View raw message