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:
Andrew Haley 2000-06-28 12:24:10 +00:00 committed by Andrew Haley
parent 580ac50392
commit 52fa9d82f4
3 changed files with 18 additions and 1 deletions

View file

@ -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];