Fix skipping of directories that begin with a '.' in -R mode.
It is not enough to avoid displaying the contents of the directory, we need to set FTS_SKIP to avoid descending into any subdirs too. Otherwise, if a ".foo" directory has a subdirectory "bar", ls will descend into bar and display its contents. From Todd Miller
This commit is contained in:
parent
a0f5a77ba6
commit
1d895808a5
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ls.c,v 1.76 2017/02/06 21:06:04 rin Exp $ */
|
/* $NetBSD: ls.c,v 1.77 2020/07/07 14:29:06 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993, 1994
|
* Copyright (c) 1989, 1993, 1994
|
||||||
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
|
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: ls.c,v 1.76 2017/02/06 21:06:04 rin Exp $");
|
__RCSID("$NetBSD: ls.c,v 1.77 2020/07/07 14:29:06 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@ -450,8 +450,10 @@ traverse(int argc, char *argv[], int options)
|
|||||||
break;
|
break;
|
||||||
case FTS_D:
|
case FTS_D:
|
||||||
if (p->fts_level != FTS_ROOTLEVEL &&
|
if (p->fts_level != FTS_ROOTLEVEL &&
|
||||||
p->fts_name[0] == '.' && !f_listdot)
|
p->fts_name[0] == '.' && !f_listdot) {
|
||||||
|
(void)fts_set(ftsp, p, FTS_SKIP);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If already output something, put out a newline as
|
* If already output something, put out a newline as
|
||||||
|
Loading…
Reference in New Issue
Block a user