diff options
-rw-r--r-- | lib/libc/gen/fts.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 1e069783ac4..ae4bc3f5d1e 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fts.c,v 1.40 2007/11/06 10:14:53 chl Exp $ */ +/* $OpenBSD: fts.c,v 1.41 2008/12/27 12:30:13 pedro Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -515,8 +515,10 @@ fts_children(FTS *sp, int 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); } |