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>
* include/jvm.h: New class _Jv_TempUTFString (helper class for
......
......@@ -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);
......
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