+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
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);