From j@uriah.heep.sax.de  Mon Mar  6 00:25:13 1995
Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id AAA26056 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 6 Mar 1995 00:24:47 -0800
Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP
	(5.67b+/DEC-Ultrix/4.3) id AA02576; Mon, 6 Mar 1995 09:21:25 +0100
Received: by sax.sax.de (8.6.9/8.6.9-s1) with UUCP
	id JAA15700 for FreeBSD-gnats-submit@freebsd.org; Mon, 6 Mar 1995 09:21:25 +0100
Received: (from j@localhost) by uriah.heep.sax.de (8.6.9/8.6.9) id JAA04706; Mon, 6 Mar 1995 09:15:22 +0100
Message-Id: <199503060815.JAA04706@uriah.heep.sax.de>
Date: Mon, 6 Mar 1995 09:15:22 +0100
From: J Wunsch <j@uriah.heep.sax.de>
Reply-To: joerg_wunsch@uriah.heep.sax.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: CTM sometimes does not fully clean up internally
X-Send-Pr-Version: 3.2

>Number:         233
>Category:       misc
>Synopsis:       CTM sometimes does not fully clean up internally
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar  6 00:30:01 1995
>Closed-Date:    Sun Mar 19 14:43:05 MET 1995
>Last-Modified:
>Originator:     J Wunsch
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
>Environment:


>Description:

ctm(1) sometimes did not free up all used resources (open pipes and
processes, heap memory).  This happened whenever one of the passes
ended prematurely, and it became very apparent when running it on
a bunch of already applied deltas, resulting in a ``gunzip: resource
temporarily unavailable'' due to the maxproc # exhausted.

>How-To-Repeat:

Run ctm(1) with a reasonable number of .gz input deltas and the
default maxproc limit of 40.

>Fix:
	
Index: ctm.c
===================================================================
RCS file: /usr/home/cvs/src/usr.sbin/ctm/ctm/ctm.c,v
retrieving revision 1.8
diff -u -r1.8 ctm.c
--- 1.8	1995/03/04 20:36:45
+++ ctm.c	1995/03/06 08:05:30
@@ -164,8 +164,8 @@
     if(!p)
 	rewind(f);
 
-    if((i=Pass1(f, applied))) 
-	return i;
+    if((i=Pass1(f, applied)))
+	goto exit_and_close;
 
     if(!p) {
         rewind(f);
@@ -187,16 +187,18 @@
 
     if(i) {
 	if((!Force) || (i & ~Exit_Forcible))
-	    return i;
+	    goto exit_and_close;
     }
 
     if(CheckIt) {
         fprintf(stderr,"All checks out ok.\n");
-	return Exit_Done;
+	i = Exit_Done;
+	goto exit_and_close;
     }
 
     i=Pass3(f);
 
+exit_and_close:
     if(!p) {
         fclose(f);
     } else {

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Mar 19 14:43:05 MET 1995 
State-Changed-Why:  
Fix applied. 
>Unformatted:



