summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-08-16 07:57:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-08-16 07:57:03 +0000
commit5b04b1daa842340b2f638850f79815ce96db8213 (patch)
tree7dd9080e8a456b0b8bfd21f3066dedd23eb56852
parent603081eb19290b7380488ba7b69da7b73e9572f5 (diff)
If the FTS_NOCHDIR flag is set and the final directory is empty,
the trailing '/' would not be chopped; pho@freebsd.org
-rw-r--r--lib/libc/gen/fts.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 18264706cfc..ea2c34f2c1e 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.19 1999/05/17 02:32:31 millert Exp $ */
+/* $OpenBSD: fts.c,v 1.20 1999/08/16 07:57:02 millert Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
#else
-static char rcsid[] = "$OpenBSD: fts.c,v 1.19 1999/05/17 02:32:31 millert Exp $";
+static char rcsid[] = "$OpenBSD: fts.c,v 1.20 1999/08/16 07:57:02 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -776,7 +776,7 @@ mem1: saved_errno = errno;
* state.
*/
if (ISSET(FTS_NOCHDIR)) {
- if (len == sp->fts_pathlen)
+ if (len == sp->fts_pathlen || nitems == 0)
--cp;
*cp = '\0';
}