From a2c38ed82e5cedcc634b5844f0cd34caaef7d7b3 Mon Sep 17 00:00:00 2001 From: lukem Date: Sat, 3 Jan 2009 06:12:14 +0000 Subject: [PATCH] Ensure fts_close() doesn't spuriously close fd 0, by testing FTS_SYMFOLLOW in fts_flags instead of fts_options. Fix provided by Ben Harris in PR 40319 --- lib/libc/gen/fts.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index d9faf5bad602..4822dab45b73 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $NetBSD: fts.c,v 1.34 2008/09/27 15:12:00 lukem Exp $ */ +/* $NetBSD: fts.c,v 1.35 2009/01/03 06:12:14 lukem Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -__RCSID("$NetBSD: fts.c,v 1.34 2008/09/27 15:12:00 lukem Exp $"); +__RCSID("$NetBSD: fts.c,v 1.35 2009/01/03 06:12:14 lukem Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -256,7 +256,7 @@ fts_close(FTS *sp) * list which has a valid parent pointer. */ if (sp->fts_cur) { - if (ISSET(FTS_SYMFOLLOW)) + if (sp->fts_cur->fts_flags & FTS_SYMFOLLOW) (void)close(sp->fts_cur->fts_symfd); for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { freep = p;