summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-28 12:24:10 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2000-06-28 12:24:10 +0000
commit58ab45fd63da3c5557388825c1adf274cb4d8224 (patch)
tree5b29ccb63d57e84b533d5502d97e0f3d92ecf224 /libjava
parent2a44ecc783d7dbbc2b96daa646ad4eadc66d39d6 (diff)
downloadgcc-58ab45fd63da3c5557388825c1adf274cb4d8224.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34755 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/io/File.java4
-rw-r--r--libjava/java/io/natFileDescriptorPosix.cc8
3 files changed, 18 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index a7b1a17fe10..6f4681f5fee 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -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.
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java
index 38bcb9f9c63..c8aaddfac2a 100644
--- a/libjava/java/io/File.java
+++ b/libjava/java/io/File.java
@@ -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;
}
diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc
index 50be35c24be..6e06a034dd9 100644
--- a/libjava/java/io/natFileDescriptorPosix.cc
+++ b/libjava/java/io/natFileDescriptorPosix.cc
@@ -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];