bjh         01/08/28 09:17:04

  Modified:    file_io/os2 readwrite.c
  Log:
  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.
  
  Revision  Changes    Path
  1.46      +7 -2      apr/file_io/os2/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/readwrite.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- readwrite.c       2001/08/23 02:01:47     1.45
  +++ readwrite.c       2001/08/28 16:17:04     1.46
  @@ -88,12 +88,17 @@
   
           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;
               }
  
  
  

Reply via email to