From ede01be2f28ee8e9f2dc61e8bcf3c167d759c6c7 Mon Sep 17 00:00:00 2001 From: Gabor Kovesdan Date: Mon, 28 Nov 2011 20:04:26 +0000 Subject: [PATCH] - Call warnx() instead of errx() if a directory is not readable when using a recursive search. This is the expected behavior instead of aborting. PR: bin/162907 Submitted by: Jan Beich MFC after: 3 days --- usr.bin/grep/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 447e8c538ecb..75ed1078a0dd 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -130,7 +130,9 @@ grep_tree(char **argv) case FTS_DNR: /* FALLTHROUGH */ case FTS_ERR: - errx(2, "%s: %s", p->fts_path, strerror(p->fts_errno)); + notfound = true; + if(!sflag) + warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); break; case FTS_D: /* FALLTHROUGH */