diff options
author | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2001-08-28 16:17:04 +0000 |
---|---|---|
committer | bjh <bjh@13f79535-47bb-0310-9956-ffa450edef68> | 2001-08-28 16:17:04 +0000 |
commit | 87d1e79af51d80fe8d1effdfdaab3992b97ff7d7 (patch) | |
tree | c0e490b38911d7c3d675092d1a335671ca1ce504 /file_io | |
parent | c991d1a73c2079a22c3f2bd5f3902b6a4cf9a30b (diff) | |
download | libapr-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.c | 9 |
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; } |