aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2003-08-19 11:59:56 +0000
committerMohan Embar <membar@gcc.gnu.org>2003-08-19 11:59:56 +0000
commit3ab37c7de76a6e34d40c9c9bd9a0101d9accfb33 (patch)
treee74f81e8ea9fcb1530d878ea47c9765fa7f48f97
parentdca5e0e850e763720133889d4f4f2c5b0f468e58 (diff)
downloadgcc-3ab37c7de76a6e34d40c9c9bd9a0101d9accfb33.zip
gcc-3ab37c7de76a6e34d40c9c9bd9a0101d9accfb33.tar.gz
gcc-3ab37c7de76a6e34d40c9c9bd9a0101d9accfb33.tar.bz2
re PR libgcj/11575 ([win32] Problem with RandomAccessFile)
PR libgcj/11575 * java/io/natFileDescriptorWin32.cc (open): Set create flag to OPEN_AWAYS when READ & WRITE regardless of APPEND flag. Honor EXCL when openning with WRITE flag. From-SVN: r70565
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/io/natFileDescriptorWin32.cc21
2 files changed, 20 insertions, 8 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 95ccb64..7fc2069 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2003-08-19 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR libgcj/11575
+ * java/io/natFileDescriptorWin32.cc (open): Set create
+ flag to OPEN_AWAYS when READ & WRITE regardless of APPEND flag.
+ Honor EXCL when openning with WRITE flag.
+
2003-08-19 Mohan Embar <gnustuff@thisiscool.com>
* include/jvm.h: New class _Jv_TempUTFString (helper class for
diff --git a/libjava/java/io/natFileDescriptorWin32.cc b/libjava/java/io/natFileDescriptorWin32.cc
index 210eb73..5066987 100644
--- a/libjava/java/io/natFileDescriptorWin32.cc
+++ b/libjava/java/io/natFileDescriptorWin32.cc
@@ -97,20 +97,25 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
if ((jflags & READ) && (jflags & WRITE))
{
access = GENERIC_READ | GENERIC_WRITE;
- if (jflags & APPEND)
- create = OPEN_ALWAYS;
+ if (jflags & EXCL)
+ create = CREATE_NEW; // this will raise error if file exists.
else
- create = CREATE_ALWAYS;
+ create = OPEN_ALWAYS; // equivalent to O_CREAT
}
- else if(jflags & READ)
- access = GENERIC_READ;
- else
+ else if (jflags & READ)
{
+ access = GENERIC_READ;
+ create = OPEN_EXISTING; // ignore EXCL
+ }
+ else
+ {
access = GENERIC_WRITE;
- if (jflags & APPEND)
+ if (jflags & EXCL)
+ create = CREATE_NEW;
+ else if (jflags & APPEND)
create = OPEN_ALWAYS;
else
- create = CREATE_ALWAYS;
+ create = CREATE_ALWAYS;
}
handle = CreateFile(buf, access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, create, 0, NULL);