Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Nov 2011 20:04:26 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228097 - head/usr.bin/grep
Message-ID:  <201111282004.pASK4Qxg006926@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gabor
Date: Mon Nov 28 20:04:26 2011
New Revision: 228097
URL: http://svn.freebsd.org/changeset/base/228097

Log:
  - 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 <jbeich@tormail.net>
  MFC after:	3 days

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==============================================================================
--- head/usr.bin/grep/util.c	Mon Nov 28 20:03:33 2011	(r228096)
+++ head/usr.bin/grep/util.c	Mon Nov 28 20:04:26 2011	(r228097)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111282004.pASK4Qxg006926>