natFileDescriptorPosix.cc (open): Recognize EXCL flag.
* java/io/natFileDescriptorPosix.cc (open): Recognize EXCL flag. * java/io/FileDescriptor.java (EXCL): New static field. * java/io/File.java (tmpdir): New static field. (createTempFile): New method. (nextValue): New method. * java/lang/natSystem.cc (init_properties): Set java.io.tmpdir property. From-SVN: r31922
This commit is contained in:
parent
a1cee8a3f3
commit
304ccb1075
5 changed files with 92 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
// natFileDescriptor.cc - Native part of FileDescriptor class.
|
||||
|
||||
/* Copyright (C) 1998, 1999 Red Hat, Inc.
|
||||
/* Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
|
@ -83,6 +83,7 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
|||
#endif
|
||||
|
||||
JvAssert ((jflags & READ) || (jflags & WRITE));
|
||||
int mode = 0644;
|
||||
if ((jflags & READ) && (jflags & WRITE))
|
||||
flags |= O_RDWR;
|
||||
else if ((jflags & READ))
|
||||
|
@ -94,9 +95,16 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
|||
flags |= O_APPEND;
|
||||
else
|
||||
flags |= O_TRUNC;
|
||||
|
||||
if ((jflags & EXCL))
|
||||
{
|
||||
flags |= O_EXCL;
|
||||
// In this case we are making a temp file.
|
||||
mode = 0600;
|
||||
}
|
||||
}
|
||||
|
||||
int fd = ::open (buf, flags, 0644);
|
||||
int fd = ::open (buf, flags, mode);
|
||||
if (fd == -1)
|
||||
{
|
||||
char msg[MAXPATHLEN + 200];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue