svn commit: r228097 - head/usr.bin/grep

Gabor Kovesdan gabor at FreeBSD.org
Mon Nov 28 20:04:26 UTC 2011


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 at 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 */


More information about the svn-src-head mailing list