summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-05-10 02:27:41 -0400
committerRich Felker <dalias@aerifal.cx>2012-05-10 02:27:41 -0400
commit96a709f0e738e37fc17fbf1ea9367e8b42c31e4e (patch)
tree76384885f0fbbed65b71b569fb00e9ed22fea14c
parent66c3fa5e8e3f32f6d04f4a78ed93d251731baa9c (diff)
downloadnoxcuse-96a709f0e738e37fc17fbf1ea9367e8b42c31e4e.tar.gz
additional error handling in grep
-rw-r--r--src/grep.c4
1 files changed, 4 insertions, 0 deletions
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);