diff options
author | Brian Havard <bjh@apache.org> | 2000-05-27 17:52:01 +0000 |
---|---|---|
committer | Brian Havard <bjh@apache.org> | 2000-05-27 17:52:01 +0000 |
commit | 1a5bbdc8d7a0c9c55a06d5928c46943ae88e20b0 (patch) | |
tree | 383c96957d742e4bc7d07b770ee6ea9eab079b22 /file_io/os2/readwrite.c | |
parent | 32ae3573360e05d2c42adcda3fde14ef996022b1 (diff) | |
download | apr-1a5bbdc8d7a0c9c55a06d5928c46943ae88e20b0.tar.gz apr-1a5bbdc8d7a0c9c55a06d5928c46943ae88e20b0.zip |
OS/2: Fix ap_write() to use the handle's mutex lock instead of critical
sections & report write errors correctly in buffered mode.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60106 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2/readwrite.c')
-rw-r--r-- | file_io/os2/readwrite.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c index 5fb3f72a3..dd44cece8 100644 --- a/file_io/os2/readwrite.c +++ b/file_io/os2/readwrite.c @@ -153,7 +153,7 @@ ap_status_t ap_write(ap_file_t *thefile, void *buf, ap_ssize_t *nbytes) int blocksize; int size = *nbytes; - DosEnterCritSec(); + ap_lock(thefile->mutex); if ( thefile->direction == 0 ) { // Position file pointer for writing at the offset we are logically reading from @@ -166,7 +166,7 @@ ap_status_t ap_write(ap_file_t *thefile, void *buf, ap_ssize_t *nbytes) while (rc == 0 && size > 0) { if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full - ap_flush(thefile); + rc = ap_flush(thefile); blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size; memcpy(thefile->buffer + thefile->bufpos, pos, blocksize); @@ -175,7 +175,7 @@ ap_status_t ap_write(ap_file_t *thefile, void *buf, ap_ssize_t *nbytes) size -= blocksize; } - DosExitCritSec(); + ap_unlock(thefile->mutex); return APR_OS2_STATUS(rc); } else { rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten); |