You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2006/03/13 20:57:42 UTC
svn commit: r385640 - /apr/apr/branches/1.2.x/file_io/win32/readwrite.c
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;
}