bjh 02/05/23 02:53:53
Modified: file_io/os2 readwrite.c
Log:
OS/2: Check more return codes when locking the file for appending.
Revision Changes Path
1.49 +11 -4 apr/file_io/os2/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/readwrite.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- readwrite.c 13 Mar 2002 20:39:10 -0000 1.48
+++ readwrite.c 23 May 2002 09:53:53 -0000 1.49
@@ -192,10 +192,17 @@
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);
+ rc = DosSetFileLocks(thefile->filedes, NULL, &all, -1, 0);
+
+ if (rc == 0) {
+ rc = DosSetFilePtr(thefile->filedes, 0, FILE_END, &newpos);
+
+ if (rc == 0) {
+ rc = DosWrite(thefile->filedes, buf, *nbytes,
&byteswritten);
+ }
+
+ DosSetFileLocks(thefile->filedes, &all, NULL, -1, 0);
+ }
} else {
rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
}