Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2006 00:09:04 GMT
From:      Charles Hardin <chardin@2wire.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/95292: A minor nit in rm.c to do an fts_close before returning from rm_tree
Message-ID:  <200604040009.k34094H8031664@www.freebsd.org>
Resent-Message-ID: <200604040010.k340AIcR063718@freefall.freebsd.org>

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

>Number:         95292
>Category:       bin
>Synopsis:       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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 04 00:10:17 GMT 2006
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604040009.k34094H8031664>