You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bj...@locus.apache.org on 2000/05/27 19:52:01 UTC

cvs commit: apache-2.0/src/lib/apr/file_io/os2 readwrite.c

bjh         00/05/27 10:52:01

  Modified:    src/lib/apr/file_io/os2 readwrite.c
  Log:
  OS/2: Fix ap_write() to use the handle's mutex lock instead of critical
  sections & report write errors correctly in buffered mode.
  
  Revision  Changes    Path
  1.26      +3 -3      apache-2.0/src/lib/apr/file_io/os2/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- readwrite.c	2000/05/26 16:23:07	1.25
  +++ readwrite.c	2000/05/27 17:52:01	1.26
  @@ -153,7 +153,7 @@
           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 @@
   
           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 @@
               size -= blocksize;
           }
   
  -        DosExitCritSec();
  +        ap_unlock(thefile->mutex);
           return APR_OS2_STATUS(rc);
       } else {
           rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);