diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2016-06-28 17:12:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2016-06-28 17:12:30 +0000 |
commit | 1b6ada3a4334b5bda93c202f584f56f92849d372 (patch) | |
tree | 6101eadfde6ea2244986ad94e32a97b00a4460c5 /lib | |
parent | 998357421f5797b5d4580a685f1935a7c54f1267 (diff) |
Do not return an error in fts_open(3) if one of the paths in argv
is empty. Otherwise, programs using fts(3) will report an error
if one of the paths is empty instead of just treating it as a
non-existent file. OK guenther@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/fts.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index e042b9fe2f0..ee3a5ba2dc8 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fts.c,v 1.53 2015/11/01 03:45:29 guenther Exp $ */ +/* $OpenBSD: fts.c,v 1.54 2016/06/28 17:12:29 millert Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -75,7 +75,6 @@ fts_open(char * const *argv, int options, FTSENT *p, *root; int nitems; FTSENT *parent, *tmp; - size_t len; /* Options check. */ if (options & ~FTS_OPTIONMASK) { @@ -107,13 +106,7 @@ fts_open(char * const *argv, int options, /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) { - /* Don't allow zero-length paths. */ - if ((len = strlen(*argv)) == 0) { - errno = ENOENT; - goto mem3; - } - - if ((p = fts_alloc(sp, *argv, len)) == NULL) + if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL) goto mem3; p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; |