Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 1999 16:08:19 +1000
From:      Peter Jeremy <jeremyp@gsmx07.alcatel.com.au>
To:        FreeBSD-gnats-submit@freebsd.org, dsr@w3.org
Subject:   ports/11903: File descriptor leak in ports/www/tidy/tidy15apr99
Message-ID:  <99May27.155237est.40345@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99May27.155237est.40345>