summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-04-05 20:26:17 +0000
committerjilles <jilles@FreeBSD.org>2014-04-05 20:26:17 +0000
commita3f8ed8103c77a93817b34e4aba4a8758e84d9db (patch)
treeef7cdf2a7280aee0179b70df6b1a14f803543402
parent15366d2a0dd20bdd5c353ec8fa34c563152158eb (diff)
downloadFreeBSD-src-a3f8ed8103c77a93817b34e4aba4a8758e84d9db.zip
FreeBSD-src-a3f8ed8103c77a93817b34e4aba4a8758e84d9db.tar.gz
MFC r262872: fts: Don't abort if an empty pathname is given.
Make fts_open(3) treat an empty pathname like any other pathname that cannot be lstatted because of [ENOENT]. It is rather confusing if rm -rf file1 "" file2 does not remove file1 and file2. PR: bin/187264
-rw-r--r--lib/libc/gen/fts.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index d98a94b..3df96d4 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -161,11 +161,7 @@ fts_open(argv, options, compar)
/* Allocate/initialize root(s). */
for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
- /* Don't allow zero-length paths. */
- if ((len = strlen(*argv)) == 0) {
- errno = ENOENT;
- goto mem3;
- }
+ len = strlen(*argv);
p = fts_alloc(sp, *argv, len);
p->fts_level = FTS_ROOTLEVEL;
OpenPOWER on IntegriCloud