apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: apr/file_io/os2 readwrite.c
Date Sat, 18 Aug 2001 09:19:25 GMT
bjh         01/08/18 02:19:25

  Modified:    file_io/os2 readwrite.c
  Log:
  OS/2: When a file is opened in append mode, make sure all writes go at the
  current end of file, even if the file is being written to by other processes.
  
  Revision  Changes    Path
  1.44      +10 -1     apr/file_io/os2/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/readwrite.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- readwrite.c	2001/08/10 21:04:47	1.43
  +++ readwrite.c	2001/08/18 09:19:25	1.44
  @@ -184,7 +184,16 @@
           apr_lock_release(thefile->mutex);
           return APR_OS2_STATUS(rc);
       } else {
  -        rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
  +        if (thefile->flags & APR_APPEND) {
  +            FILELOCK all = { 0, 0x7fffffff };
  +            ULONG newpos;
  +            DosSetFileLocks(thefile->filedes, NULL, &all, -1, 0);
  +            DosSetFilePtr(thefile->filedes, 0, FILE_END, &newpos);
  +            rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
  +            DosSetFileLocks(thefile->filedes, &all, NULL, -1, 0);
  +        } else {
  +            rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
  +        }
   
           if (rc) {
               *nbytes = 0;
  
  
  

Mime
View raw message