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:
parent
dca5e0e850
commit
3ab37c7de7
2 changed files with 23 additions and 11 deletions
|
@ -97,21 +97,26 @@ java::io::FileDescriptor::open (jstring path, jint jflags) {
|
|||
if ((jflags & READ) && (jflags & WRITE))
|
||||
{
|
||||
access = GENERIC_READ | GENERIC_WRITE;
|
||||
if (jflags & APPEND)
|
||||
if (jflags & EXCL)
|
||||
create = CREATE_NEW; // this will raise error if file exists.
|
||||
else
|
||||
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 & EXCL)
|
||||
create = CREATE_NEW;
|
||||
else if (jflags & APPEND)
|
||||
create = OPEN_ALWAYS;
|
||||
else
|
||||
create = CREATE_ALWAYS;
|
||||
}
|
||||
else if(jflags & READ)
|
||||
access = GENERIC_READ;
|
||||
else
|
||||
{
|
||||
access = GENERIC_WRITE;
|
||||
if (jflags & APPEND)
|
||||
create = OPEN_ALWAYS;
|
||||
else
|
||||
create = CREATE_ALWAYS;
|
||||
}
|
||||
|
||||
handle = CreateFile(buf, access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, create, 0, NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue