diff options
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/grep.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 5b8644c36..84a6f7b1c 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -762,8 +762,9 @@ int grep_main(int argc UNUSED_PARAM, char **argv) | |||
762 | if (option_mask32 & OPT_f) { | 762 | if (option_mask32 & OPT_f) { |
763 | load_regexes_from_file(fopt); | 763 | load_regexes_from_file(fopt); |
764 | if (!pattern_head) { /* -f EMPTY_FILE? */ | 764 | if (!pattern_head) { /* -f EMPTY_FILE? */ |
765 | /* GNU grep treats it as "nothing matches" */ | 765 | /* GNU grep treats it as "nothing matches" except when -x */ |
766 | llist_add_to(&pattern_head, new_grep_list_data((char*) "", 0)); | 766 | const char *data = (option_mask32 & OPT_x) ? ".*" : ""; |
767 | llist_add_to(&pattern_head, new_grep_list_data((char*)data, 0)); | ||
767 | invert_search ^= 1; | 768 | invert_search ^= 1; |
768 | } | 769 | } |
769 | } | 770 | } |