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
This commit is contained in:
parent
2bd5b48033
commit
a2c38ed82e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user