From b2969c7cce26fcf800a05bdc7ddb49f9c3ae393c Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 28 Jun 2016 17:12:29 +0000 Subject: [PATCH] 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@ --- lib/libc/gen/fts.c | 11 ++--------- 1 file 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; -- 2.20.1