From bf4497406f4eb67e57e3bfaa3ef98c8811104847 Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Fri, 23 Sep 2005 13:50:24 +0000 Subject: SUSv3 -q compatibily exit status correction for grep again --- findutils/grep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/findutils/grep.c b/findutils/grep.c index 986804553..e41f1a3be 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -398,7 +398,9 @@ extern int grep_main(int argc, char **argv) } #endif - if(be_quiet) - return error_open_count ? 2 : 0; + if(be_quiet && matched) + return 0; + if(error_open_count) + return 2; return !matched; /* invert return value 0 = success, 1 = failed */ } -- cgit v1.2.3