diff options
author | jilles <jilles@FreeBSD.org> | 2014-03-06 22:47:11 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2014-03-06 22:47:11 +0000 |
commit | 1e8c254d0f64cd781d7a85efb228526702397fcd (patch) | |
tree | cde5f0bbd126633b44816bfb2828117d18278816 /lib/libc | |
parent | 6e9d0414f8881a1e018cdb9556f8b18e0af324fb (diff) | |
download | FreeBSD-src-1e8c254d0f64cd781d7a85efb228526702397fcd.zip FreeBSD-src-1e8c254d0f64cd781d7a85efb228526702397fcd.tar.gz |
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
MFC after: 2 weeks
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/fts.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 1724f9c0fd..7635fbc 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; |