From owner-freebsd-ports Wed May 26 23:10: 4 1999 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2C48215065 for ; Wed, 26 May 1999 23:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id XAA82755; Wed, 26 May 1999 23:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with ESMTP id 3C51A14F2C for ; Wed, 26 May 1999 23:08:27 -0700 (PDT) (envelope-from jeremyp@gsmx07.alcatel.com.au) Received: by border.alcanet.com.au id <40345>; Thu, 27 May 1999 15:52:37 +1000 Message-Id: <99May27.155237est.40345@border.alcanet.com.au> Date: Thu, 27 May 1999 16:08:19 +1000 From: Peter Jeremy Reply-To: peter.jeremy@alcatel.com.au To: FreeBSD-gnats-submit@freebsd.org, dsr@w3.org X-Send-Pr-Version: 3.2 Subject: ports/11903: File descriptor leak in ports/www/tidy/tidy15apr99 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 11903 >Category: ports >Synopsis: File descriptor leak in ports/www/tidy/tidy15apr99 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed May 26 23:10:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Peter Jeremy >Release: FreeBSD 4.0-CURRENT i386 >Organization: Alcatel Australia Limited >Environment: Running FreeBSD 4.0-CURRENT from mid-May, building cvs/www/en from cvs-cur 5361 with tidy from tidy15apr99 (tidy-0.4.99.2). >Description: When an error file is specified to tidy (-f file), the error file is fopen()d for every HTML file specified on the command line, but not closed until all HTML files have been processed. If a large number of files are specified on the command line (eg processing the FreeBSD handbook), this can overflow the process or system file descriptor table. >How-To-Repeat: cd .../cvs/www/en CVSROOT=... make -DENGLISH_ONLY >Fix: The following fix opens the error file whenever a `-f' option is seen. Multiple -f options can be specified and the previous error file will be closed before the new one is opened. --- tidy.c~ Fri Apr 16 05:34:32 1999 +++ tidy.c Thu May 27 15:55:33 1999 @@ -732,9 +732,18 @@ { if (argc >= 3) { + if (errfile) + fclose(errout); errfile = argv[2]; --argc; ++argv; + if (errfile) + { + fp = fopen(errfile, "w"); + + if (fp != null) + errout = fp; + } } } else if (strcmp(argv[1], "-wrap") == 0 || @@ -779,14 +788,6 @@ /* ensure config is self-consistent */ AdjustConfig(); - - if (errfile) - { - fp = fopen(errfile, "w"); - - if (fp != null) - errout = fp; - } if (argc > 1) { >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message