summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-08-28 16:17:04 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-08-28 16:17:04 +0000
commit87d1e79af51d80fe8d1effdfdaab3992b97ff7d7 (patch)
treec0e490b38911d7c3d675092d1a335671ca1ce504 /file_io
parentc991d1a73c2079a22c3f2bd5f3902b6a4cf9a30b (diff)
downloadlibapr-87d1e79af51d80fe8d1effdfdaab3992b97ff7d7.tar.gz
OS/2: Fix bug in buffered read where buffer control variables were left in
an inconsistent state after a 0 length read (EOF). The amount of data in the buffer (dataRead) was being reset but the current position within the buffer (bufpos) was not. This changes it so that dataRead is not reset, allowing the buffer contents to be reused after a seek. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62238 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/os2/readwrite.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c
index 4e4ce04ef..d2cea2e8f 100644
--- a/file_io/os2/readwrite.c
+++ b/file_io/os2/readwrite.c
@@ -88,12 +88,17 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size
while (rc == 0 && size > 0) {
if (thefile->bufpos >= thefile->dataRead) {
- rc = DosRead(thefile->filedes, thefile->buffer, APR_FILE_BUFSIZE, &thefile->dataRead );
- if (thefile->dataRead == 0) {
+ ULONG bytesread;
+ rc = DosRead(thefile->filedes, thefile->buffer,
+ APR_FILE_BUFSIZE, &bytesread);
+
+ if (bytesread == 0) {
if (rc == 0)
thefile->eof_hit = TRUE;
break;
}
+
+ thefile->dataRead = bytesread;
thefile->filePtr += thefile->dataRead;
thefile->bufpos = 0;
}