aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/natFileDescriptorWin32.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/io/natFileDescriptorWin32.cc')
-rw-r--r--libjava/java/io/natFileDescriptorWin32.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc
index 694272a67bd..bc9cbc85bc9 100644
--- a/libjava/java/io/natFileDescriptorWin32.cc
+++ b/libjava/java/io/natFileDescriptorWin32.cc
@@ -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;
}