1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

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.  OK deraadt@
This commit is contained in:
millert 2020-07-06 00:51:51 +00:00
parent 5bde2954c1
commit b352e5558a

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ls.c,v 1.51 2018/09/13 15:23:32 millert Exp $ */
/* $OpenBSD: ls.c,v 1.52 2020/07/06 00:51:51 millert Exp $ */
/* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */
/*
@ -369,8 +369,10 @@ traverse(int argc, char *argv[], int options)
switch (p->fts_info) {
case FTS_D:
if (p->fts_name[0] == '.' &&
p->fts_level != FTS_ROOTLEVEL && !f_listdot)
p->fts_level != FTS_ROOTLEVEL && !f_listdot) {
(void)fts_set(ftsp, p, FTS_SKIP);
break;
}
/*
* If already output something, put out a newline as