From nobody@FreeBSD.org  Tue Apr  4 00:09:06 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B70A516A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Apr 2006 00:09:06 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 265C943D78
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  4 Apr 2006 00:09:05 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k34094sT031666
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 4 Apr 2006 00:09:04 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k34094H8031664;
	Tue, 4 Apr 2006 00:09:04 GMT
	(envelope-from nobody)
Message-Id: <200604040009.k34094H8031664@www.freebsd.org>
Date: Tue, 4 Apr 2006 00:09:04 GMT
From: Charles Hardin <chardin@2wire.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: A minor nit in rm.c to do an fts_close before returning from rm_tree
X-Send-Pr-Version: www-2.3

>Number:         95292
>Category:       bin
>Synopsis:       [patch] rm(1): A minor nit in rm.c to do an fts_close before returning from rm_tree
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 04 00:10:17 GMT 2006
>Closed-Date:    Sat Apr 15 09:26:42 GMT 2006
>Last-Modified:  Sat Apr 15 09:26:42 GMT 2006
>Originator:     Charles Hardin
>Release:        CURRENT from cvs
>Organization:
>Environment:
>Description:
Just doing a code review and noticed there wasn't an fts_close in the rm_tree function in rm.c.

This seems trivial, except another developer cut and pasted the code and introduced an fd leak as a result into another application.

So, this isn't really a bug, bug... Just a suggestion...
>How-To-Repeat:

>Fix:
Index: rm.c
===================================================================
RCS file: /home/ncvs/src/bin/rm/rm.c,v
retrieving revision 1.53
diff -u -r1.53 rm.c
--- rm.c        29 Sep 2005 20:40:29 -0000      1.53
+++ rm.c        4 Apr 2006 00:01:53 -0000
@@ -307,6 +307,7 @@
        }
        if (errno)
                err(1, "fts_read");
+       fts_close(fts);
 }
  
 void

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Sat Apr 15 09:26:27 UTC 2006 
State-Changed-Why:  
Fixed in HEAD.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=95292 
>Unformatted:
