bin/95292: A minor nit in rm.c to do an fts_close before returning from rm_tree

Charles Hardin chardin at 2wire.com
Tue Apr 4 00:10:24 UTC 2006


>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:


More information about the freebsd-bugs mailing list