You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2001/08/18 11:19:25 UTC
cvs commit: apr/file_io/os2 readwrite.c
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;