Bugzilla Bug 340956: when emulating PR_APPEND, we should use PR_Seek64 MOZILLA_1_8_0_BRANCH
authorwtchang%redhat.com
Mon, 12 Jun 2006 20:29:02 +0000
branchMOZILLA_1_8_0_BRANCH
changeset 3663 5c5108dac4a7e82fb649e81a52f725d8e6ac26a7
parent 3602 acf5b7edfb5302171f20c30be2f2294742b045dc
push idunknown
push userunknown
push dateunknown
bugs340956
Bugzilla Bug 340956: when emulating PR_APPEND, we should use PR_Seek64 instead of PR_Seek, otherwise it won't work on large files. The patch is contributed by Nils Maier <MaierMan@web.de> and Masatoshi Kimura (:emk) <VYV03354@nifty.ne.jp>. r=wtc. Thanks to Nils Maier for tracking down the bug. a=dveditz for approval1.8.0.5+. Tag: MOZILLA_1_8_0_BRANCH
pr/src/io/prfile.c
--- a/pr/src/io/prfile.c
+++ b/pr/src/io/prfile.c
@@ -94,20 +94,19 @@ static PRInt32 PR_CALLBACK FileWrite(PRF
         PR_SetError(PR_IO_PENDING_ERROR, 0);
 	    rv = -1;
     }
     if (rv != 0)
     	return rv;
 
     count = 0;
 #if !defined(_PR_HAVE_O_APPEND)  /* Bugzilla: 4090, 276330 */
-    if ( PR_TRUE == fd->secret->appendMode ) {
-        rv = PR_Seek(fd, 0, PR_SEEK_END );
-        if ( -1 == rv )  {
-            return rv;
+    if (fd->secret->appendMode) {
+        if (PR_Seek64(fd, 0, PR_SEEK_END) == -1) {
+            return -1;
         }
     } /* if (fd->secret->appendMode...) */
 #endif /* _PR_HAVE_O_APPEND */
     while (amount > 0) {
 		temp = _PR_MD_WRITE(fd, buf, amount);
 		if (temp < 0) {
 			count = -1;
 			break;