apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/file_io/unix readwrite.c
Date Wed, 29 Aug 2001 20:38:38 GMT
trawick     01/08/29 13:38:38

  Modified:    .        CHANGES
               file_io/unix readwrite.c
  Log:
  fix a problem with buffered files on unix which was exposed
  when we read to the end of the file then seeked back a ways
  then did fgets
  
  Submitted by:	Brian Havard
  
  Revision  Changes    Path
  1.148     +2 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- CHANGES	2001/08/29 15:20:23	1.147
  +++ CHANGES	2001/08/29 20:38:38	1.148
  @@ -1,5 +1,7 @@
   Changes with APR b1  
   
  +  *) Fix a problem with buffered files on Unix.  [Brian Havard]
  +
     *) Fix the bungling of getaddrinfo() error codes.  [Jeff Trawick]
   
     *) Add an apr_thread_once function to APR.  This allows a
  
  
  
  1.72      +4 -3      apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- readwrite.c	2001/08/24 12:19:01	1.71
  +++ readwrite.c	2001/08/29 20:38:38	1.72
  @@ -137,16 +137,17 @@
           }
           while (rv == 0 && size > 0) {
               if (thefile->bufpos >= thefile->dataRead) {
  -                thefile->dataRead = read(thefile->filedes, thefile->buffer, APR_FILE_BUFSIZE);
  -                if (thefile->dataRead == 0) {
  +                int bytesread = read(thefile->filedes, thefile->buffer, APR_FILE_BUFSIZE);
  +                if (bytesread == 0) {
                       thefile->eof_hit = TRUE;
                       rv = APR_EOF;
                       break;
                   }
  -                else if (thefile->dataRead == -1) {
  +                else if (bytesread == -1) {
                       rv = errno;
                       break;
                   }
  +                thefile->dataRead = bytesread;
                   thefile->filePtr += thefile->dataRead;
                   thefile->bufpos = 0;
               }
  
  
  

Mime
View raw message