2002-04-29 Adam King <aking@dreammechanics.com>
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Apr 2002 03:54:50 +0000 (03:54 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Apr 2002 03:54:50 +0000 (03:54 +0000)
* java/io/natFileDescriptorWin32.cc (open): Move file pointer to end
of file in APPEND mode.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52869 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/java/io/natFileDescriptorWin32.cc

index 2cbcf4e..b229277 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-29  Adam King <aking@dreammechanics.com>
+
+       * java/io/natFileDescriptorWin32.cc (open): Move file pointer to end
+       of file in APPEND mode.
+
 2002-04-25  David S. Miller  <davem@redhat.com>
 
        PR target/6422
index 694272a..bc9cbc8 100644 (file)
@@ -124,6 +124,13 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
       throw new FileNotFoundException (JvNewStringLatin1 (msg));
     }
 
+  // For APPEND mode, move the file pointer to the end of the file.
+  if (jflags & APPEND)
+    {
+      DWORD low = SetFilePointer (handle, 0, NULL, FILE_END);
+      if ((low == 0xffffffff) && (GetLastError () != NO_ERROR)) 
+        throw new FileNotFoundException (JvNewStringLatin1 (winerr ()));
+    }
   return (jint)handle;
 }