Module Name: src
Committed By: christos
Date: Tue Jul 7 14:29:07 UTC 2020
Modified Files:
src/bin/ls: ls.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/bin/ls/ls.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/ls/ls.c
diff -u src/bin/ls/ls.c:1.76 src/bin/ls/ls.c:1.77
--- src/bin/ls/ls.c:1.76 Mon Feb 6 16:06:04 2017
+++ src/bin/ls/ls.c Tue Jul 7 10:29:06 2020
@@ -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
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#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 /* not lint */
@@ -450,8 +450,10 @@ traverse(int argc, char *argv[], int opt
break;
case FTS_D:
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;
+ }
/*
* If already output something, put out a newline as