svn commit: r189348 - head/lib/libc/gen

David Schultz das at FreeBSD.org
Tue Mar 3 19:30:22 PST 2009


Author: das
Date: Wed Mar  4 03:30:21 2009
New Revision: 189348
URL: http://svn.freebsd.org/changeset/base/189348

Log:
  Fix a file descriptor leak in fts_child().
  
  Obtained from:	NetBSD

Modified:
  head/lib/libc/gen/fts.c

Modified: head/lib/libc/gen/fts.c
==============================================================================
--- head/lib/libc/gen/fts.c	Wed Mar  4 03:22:03 2009	(r189347)
+++ head/lib/libc/gen/fts.c	Wed Mar  4 03:30:21 2009	(r189348)
@@ -570,8 +570,10 @@ fts_children(sp, instr)
 	if ((fd = _open(".", O_RDONLY, 0)) < 0)
 		return (NULL);
 	sp->fts_child = fts_build(sp, instr);
-	if (fchdir(fd))
+	if (fchdir(fd)) {
+		(void)_close(fd);
 		return (NULL);
+	}
 	(void)_close(fd);
 	return (sp->fts_child);
 }


More information about the svn-src-all mailing list