Commit 3ab37c7d by Danny Smith Committed by Mohan Embar

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
parent dca5e0e8
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> 2003-08-19 Mohan Embar <gnustuff@thisiscool.com>
* include/jvm.h: New class _Jv_TempUTFString (helper class for * include/jvm.h: New class _Jv_TempUTFString (helper class for
......
...@@ -97,17 +97,22 @@ java::io::FileDescriptor::open (jstring path, jint jflags) { ...@@ -97,17 +97,22 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
if ((jflags & READ) && (jflags & WRITE)) if ((jflags & READ) && (jflags & WRITE))
{ {
access = GENERIC_READ | GENERIC_WRITE; access = GENERIC_READ | GENERIC_WRITE;
if (jflags & APPEND) if (jflags & EXCL)
create = OPEN_ALWAYS; create = CREATE_NEW; // this will raise error if file exists.
else else
create = CREATE_ALWAYS; create = OPEN_ALWAYS; // equivalent to O_CREAT
} }
else if(jflags & READ) else if (jflags & READ)
{
access = GENERIC_READ; access = GENERIC_READ;
create = OPEN_EXISTING; // ignore EXCL
}
else else
{ {
access = GENERIC_WRITE; access = GENERIC_WRITE;
if (jflags & APPEND) if (jflags & EXCL)
create = CREATE_NEW;
else if (jflags & APPEND)
create = OPEN_ALWAYS; create = OPEN_ALWAYS;
else else
create = CREATE_ALWAYS; create = CREATE_ALWAYS;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment