From paul@lambda.demon.co.uk  Fri Jun 23 11:03:17 1995
Received: from lambda.demon.co.uk (lambda.demon.co.uk [158.152.17.124])
          by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id LAA19806
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 23 Jun 1995 11:03:10 -0700
Received: (from paul@localhost) by lambda.demon.co.uk (8.6.11/8.6.9) id TAA01412; Fri, 23 Jun 1995 19:03:15 +0100
Message-Id: <199506231803.TAA01412@lambda.demon.co.uk>
Date: Fri, 23 Jun 1995 19:03:15 +0100
From: Paul Richards <paul@lambda.demon.co.uk>
Reply-To: paul@lambda.demon.co.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: ar utility exausts all available file descriptors
X-Send-Pr-Version: 3.2

>Number:         557
>Category:       bin
>Synopsis:       ar utility exausts all available file descriptors
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 23 11:10:01 1995
>Closed-Date:    Mon Jan 22 05:31:49 PST 1996
>Last-Modified:  Mon Jan 22 05:32:21 PST 1996
>Originator:     bgosse@relay.nswc.navy.mil
>Release:        FreeBSD 2.0-RELEASE i386
>Organization:
Home
>Environment:

	i386 @ 25 MHz, 8 Mbyte RAM, X11R6, olwm	

>Description:

	When building a debug version of libxview the 'ar' utility
	exausted all available file descriptors.  This occurred due
	to the Makefile specifing all files in the directory in a
	single pass.  The number of files on the command line that 
	did not need to be updated in the archive exceeded the 
	available file descriptors for the process.

>How-To-Repeat:

	Build the libxview library.

>Fix:
	
	apply the following patch to /usr/src/usr.bin/ar/replace.c rev 8.3
	the patch closes the open file that does not require updating in
	the archive before moving to the next file in the list.

***************
*** 102,109 ****
  				goto useold;
  			}
  			(void)fstat(sfd, &sb);
! 			if (options & AR_U && sb.st_mtime <= chdr.date)
  				goto useold;
  
  			if (options & AR_V)
  			     (void)printf("r - %s\n", file);
--- 102,111 ----
  				goto useold;
  			}
  			(void)fstat(sfd, &sb);
! 			if (options & AR_U && sb.st_mtime <= chdr.date) {
! 				(void)close(sfd);
  				goto useold;
+ 			}
  
  			if (options & AR_V)
  			     (void)printf("r - %s\n", file);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Mon Jan 22 05:31:49 PST 1996 
State-Changed-Why:  
Fixed in 2.1. 
>Unformatted:

