diff options
| author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-06-28 12:24:10 +0000 |
|---|---|---|
| committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-06-28 12:24:10 +0000 |
| commit | 58ab45fd63da3c5557388825c1adf274cb4d8224 (patch) | |
| tree | 5b29ccb63d57e84b533d5502d97e0f3d92ecf224 /libjava/java | |
| parent | 2a44ecc783d7dbbc2b96daa646ad4eadc66d39d6 (diff) | |
| download | ppe42-gcc-58ab45fd63da3c5557388825c1adf274cb4d8224.tar.gz ppe42-gcc-58ab45fd63da3c5557388825c1adf274cb4d8224.zip | |
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/java')
| -rw-r--r-- | libjava/java/io/File.java | 4 | ||||
| -rw-r--r-- | libjava/java/io/natFileDescriptorPosix.cc | 8 |
2 files changed, 11 insertions, 1 deletions
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]; |

