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
This commit is contained in:
Danny Smith 2003-08-19 11:59:56 +00:00 committed by Mohan Embar
parent dca5e0e850
commit 3ab37c7de7
2 changed files with 23 additions and 11 deletions

View File

@ -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

View File

@ -97,17 +97,22 @@ 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;
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;