summaryrefslogtreecommitdiff
path: root/src/grep.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-11-19 01:02:08 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-11-19 01:18:31 -0800
commit5b8900267ff93688fad2a7ab0b25dc57b42ea9e7 (patch)
tree31821a748d2982893bd79ddc7e4d4d07de7bb287 /src/grep.c
parente25ea1223d0fb50e759907cdd88e8096b354cbab (diff)
downloadgrep-5b8900267ff93688fad2a7ab0b25dc57b42ea9e7.tar.gz
grep -f /dev/null -L PAT FILE outputs FILE
* NEWS: Document this. * src/grep.c (main): Do not exit right away with -L. * tests/skip-read: Test for the fix.
Diffstat (limited to 'src/grep.c')
-rw-r--r--src/grep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/grep.c b/src/grep.c
index 066df8cb..a794af48 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2818,8 +2818,9 @@ main (int argc, char **argv)
/* If it is easy to see that matching cannot succeed (e.g., 'grep -f
/dev/null'), fail without reading the input. */
- if (max_count == 0
- || (keycc == 0 && out_invert && !match_lines && !match_words))
+ if ((max_count == 0
+ || (keycc == 0 && out_invert && !match_lines && !match_words))
+ && list_files != LISTFILES_NONMATCHING)
return EXIT_FAILURE;
if (color_option == 2)