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
3 changed files with 18 additions and 1 deletions
|
@ -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>
|
2000-06-28 Warren Levy <warrenl@cygnus.com>
|
||||||
|
|
||||||
* gnu/java/security/provider/Gnu.java: New file.
|
* 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;
|
String l = prefix + t.substring(t.length() - 6) + suffix;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
desc.open (l, FileDescriptor.WRITE | FileDescriptor.EXCL);
|
desc = new FileDescriptor
|
||||||
|
(l, FileDescriptor.WRITE | FileDescriptor.EXCL);
|
||||||
|
desc.close ();
|
||||||
ret.setPath(l);
|
ret.setPath(l);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ details. */
|
||||||
#include <java/io/EOFException.h>
|
#include <java/io/EOFException.h>
|
||||||
#include <java/lang/ArrayIndexOutOfBoundsException.h>
|
#include <java/lang/ArrayIndexOutOfBoundsException.h>
|
||||||
#include <java/lang/NullPointerException.h>
|
#include <java/lang/NullPointerException.h>
|
||||||
|
#include <java/lang/System.h>
|
||||||
#include <java/lang/String.h>
|
#include <java/lang/String.h>
|
||||||
#include <java/lang/Thread.h>
|
#include <java/lang/Thread.h>
|
||||||
#include <java/io/FileNotFoundException.h>
|
#include <java/io/FileNotFoundException.h>
|
||||||
|
@ -105,6 +106,13 @@ java::io::FileDescriptor::open (jstring path, jint jflags)
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = ::open (buf, flags, mode);
|
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)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
char msg[MAXPATHLEN + 200];
|
char msg[MAXPATHLEN + 200];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue