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:
committed by
Andrew Haley
parent
580ac50392
commit
52fa9d82f4
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user