You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2010/04/04 18:44:16 UTC
svn commit: r930715 - /apr/apr/trunk/file_io/os2/readwrite.c
Author: bjh
Date: Sun Apr 4 16:44:15 2010
New Revision: 930715
URL: http://svn.apache.org/viewvc?rev=930715&view=rev
Log:
OS/2: Fix incorrect error code conversion in apr_file_write() for buffered
files.
Modified:
apr/apr/trunk/file_io/os2/readwrite.c
Modified: apr/apr/trunk/file_io/os2/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/os2/readwrite.c?rev=930715&r1=930714&r2=930715&view=diff
==============================================================================
--- apr/apr/trunk/file_io/os2/readwrite.c (original)
+++ apr/apr/trunk/file_io/os2/readwrite.c Sun Apr 4 16:44:15 2010
@@ -162,6 +162,7 @@ APR_DECLARE(apr_status_t) apr_file_write
char *pos = (char *)buf;
int blocksize;
int size = *nbytes;
+ apr_status_t rv = APR_SUCCESS;
file_lock(thefile);
@@ -174,10 +175,11 @@ APR_DECLARE(apr_status_t) apr_file_write
thefile->direction = 1;
}
- while (rc == 0 && size > 0) {
- if (thefile->bufpos == thefile->bufsize) // write buffer is full
- /* XXX bug; - rc is double-transformed os->apr below */
- rc = apr_file_flush(thefile);
+ while (rv == APR_SUCCESS && size > 0) {
+ if (thefile->bufpos == thefile->bufsize) {
+ /* write buffer is full */
+ rv = apr_file_flush(thefile);
+ }
blocksize = size > thefile->bufsize - thefile->bufpos ? thefile->bufsize - thefile->bufpos : size;
memcpy(thefile->buffer + thefile->bufpos, pos, blocksize);
@@ -187,7 +189,7 @@ APR_DECLARE(apr_status_t) apr_file_write
}
file_unlock(thefile);
- return APR_FROM_OS_ERROR(rc);
+ return rv;
} else {
if (thefile->flags & APR_FOPEN_APPEND) {
FILELOCK all = { 0, 0x7fffffff };