diff options
Diffstat (limited to 'src/grep.c')
-rw-r--r-- | src/grep.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |