From 96a709f0e738e37fc17fbf1ea9367e8b42c31e4e Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 10 May 2012 02:27:41 -0400 Subject: additional error handling in grep --- src/grep.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/grep.c b/src/grep.c index ae5e941..9f367cc 100644 --- a/src/grep.c +++ b/src/grep.c @@ -185,6 +185,10 @@ process_stdin: } } } + if (ferror(f) && !(flags & FLAG_s)) { + fprintf(stderr, "%s: ", argv[0]); + perror(filename); + } if (flags & FLAG_c) { if (multifile) printf("%s:%lld\n", filename, count); -- cgit v1.2.1