diff options
-rw-r--r-- | lib/libc/gen/fts.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index a2ac72b17e8..43d0726c39d 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fts.c,v 1.11 1997/09/01 02:44:17 millert Exp $ */ +/* $OpenBSD: fts.c,v 1.12 1997/09/20 17:33:45 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.11 1997/09/01 02:44:17 millert Exp $"; +static char rcsid[] = "$OpenBSD: fts.c,v 1.12 1997/09/20 17:33:45 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -87,6 +87,7 @@ fts_open(argv, options, compar) register FTSENT *p, *root; register int nitems; FTSENT *parent, *tmp; + char *a; int len; /* Options check. */ @@ -126,6 +127,13 @@ fts_open(argv, options, compar) goto mem3; } + /* Strip trailing '/' from paths */ + a = *argv + len - 1; + while (a > *argv && *a == '/') { + a--; + len--; + } + p = fts_alloc(sp, *argv, len); p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; |