re GNATS java.io/203 (File.createTempFile doesn't close descriptor)
2000-06-27 Andrew Haley <aph@cygnus.com> * java/io/File.java (createTempFile): Close the FileDescriptor used to create a temp file. Fixes some of PR 203. * java/io/natFileDescriptorPosix.cc (open): Call garbage collection if we run out of file handles. From-SVN: r34755
This commit is contained in:
parent
580ac50392
commit
52fa9d82f4
@ -1,3 +1,10 @@
|
||||
2000-06-27 Andrew Haley <aph@cygnus.com>
|
||||
|
||||
* java/io/File.java (createTempFile): Close the FileDescriptor
|
||||
used to create a temp file. Fixes some of PR 203.
|
||||
* java/io/natFileDescriptorPosix.cc (open): Call garbage
|
||||
collection if we run out of file handles.
|
||||
|
||||
2000-06-28 Warren Levy <warrenl@cygnus.com>
|
||||
|
||||
* gnu/java/security/provider/Gnu.java: New file.
|
||||
|
@ -260,7 +260,9 @@ public class File implements Serializable
|
||||
String l = prefix + t.substring(t.length() - 6) + suffix;
|
||||
try
|
||||
{
|
||||
desc.open (l, FileDescriptor.WRITE | FileDescriptor.EXCL);
|
||||
desc = new FileDescriptor
|
||||
(l, FileDescriptor.WRITE | FileDescriptor.EXCL);
|
||||
desc.close ();
|
||||
ret.setPath(l);
|
||||
return ret;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ details. */
|
||||
#include <java/io/EOFException.h>
|
||||
#include <java/lang/ArrayIndexOutOfBoundsException.h>
|
||||
#include <java/lang/NullPointerException.h>
|
||||
#include <java/lang/System.h>
|
||||
#include <java/lang/String.h>
|
||||
#include <java/lang/Thread.h>
|
||||
#include <java/io/FileNotFoundException.h>
|
||||
@ -105,6 +106,13 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
||||
}
|
||||
|
||||
int fd = ::open (buf, flags, mode);
|
||||
if (fd == -1 && errno == EMFILE)
|
||||
{
|
||||
// Because finalize () calls close () we might be able to continue.
|
||||
java::lang::System::gc ();
|
||||
java::lang::System::runFinalization ();
|
||||
fd = ::open (buf, flags, mode);
|
||||
}
|
||||
if (fd == -1)
|
||||
{
|
||||
char msg[MAXPATHLEN + 200];
|
||||
|
Loading…
Reference in New Issue
Block a user