This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[java/PATCH] PR 30454 Fix bootstrap on a couple of targets, empty "zip" file in class path can cause leakage of file streams
- From: Andrew Pinski <pinskia at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Tue, 23 Jan 2007 09:21:34 -0800
- Subject: [java/PATCH] PR 30454 Fix bootstrap on a couple of targets, empty "zip" file in class path can cause leakage of file streams
Hi,
The problem here is that empty "zip" files in the classpath would
cause leakage of file streams which meant after a while, we hit the
limit of opened files. So when we try to open a class file, we would
fail.
This patch closes the file streams which are not referenced anywhere
after the call to opendir_in_zip because of a check failed.
OK? Bootstrapped on powerpc-darwin with an open file limit of 256. The
testsuite is running right now and will be done later tonight but
getting the bootstrap up and working is important.
Thanks,
Andrew Pinski
* jcf-io.c (opendir_in_zip): Close the file if there is an error
in the zip file.
Index: java/jcf-io.c
===================================================================
--- java/jcf-io.c (revision 121081)
+++ java/jcf-io.c (working copy)
@@ -134,10 +134,16 @@ opendir_in_zip (const char *zipfile, int
{
jcf_dependency_add_file (zipfile, is_system);
if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC)
- return NULL;
+ {
+ close (fd);
+ return NULL;
+ }
lseek (fd, 0L, SEEK_SET);
if (read_zip_archive (zipf) != 0)
- return NULL;
+ {
+ close (fd);
+ return NULL;
+ }
}
SeenZipFiles = zipf;