From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14376 invoked by alias); 23 Jan 2007 17:23:08 -0000 Received: (qmail 14360 invoked by uid 22791); 23 Jan 2007 17:23:07 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.171) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 23 Jan 2007 17:23:01 +0000 Received: by ug-out-1314.google.com with SMTP id s2so1267335uge for ; Tue, 23 Jan 2007 09:22:58 -0800 (PST) Received: by 10.67.101.10 with SMTP id d10mr8887361ugm.1169572978266; Tue, 23 Jan 2007 09:22:58 -0800 (PST) Received: from ?192.168.0.102? ( [68.124.23.116]) by mx.google.com with ESMTP id 30sm7909269ugf.2007.01.23.09.22.56; Tue, 23 Jan 2007 09:22:57 -0800 (PST) Subject: [java/PATCH] PR 30454 Fix bootstrap on a couple of targets, empty "zip" file in class path can cause leakage of file streams To: gcc-patches@gcc.gnu.org, java-patches@gcc.gnu.org Content-Type: multipart/mixed; boundary="=-0loIKUkEpqzpsb+Ku3N1" Date: Tue, 23 Jan 2007 17:23:00 -0000 Message-Id: <1169572895.2636.85.camel@celery.andrew.com> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) From: Andrew Pinski Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2007-q1/txt/msg00149.txt.bz2 --=-0loIKUkEpqzpsb+Ku3N1 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 646 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. --=-0loIKUkEpqzpsb+Ku3N1 Content-Disposition: attachment; filename=fixjava.diff.txt Content-Type: text/x-patch; name=fixjava.diff.txt; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 577 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; --=-0loIKUkEpqzpsb+Ku3N1--