diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-03-28 22:12:09 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-03-28 22:12:09 +0200 |
commit | 73dfdda92e20da718a9cb398ed762cc09c82e3a7 (patch) | |
tree | dcc9eefdb5e6b70cf473036c3995f967fca7b6e5 | |
parent | b9b7aa1910907f59f1130667fbe7b870087e97f8 (diff) | |
download | busybox-w32-73dfdda92e20da718a9cb398ed762cc09c82e3a7.tar.gz busybox-w32-73dfdda92e20da718a9cb398ed762cc09c82e3a7.tar.bz2 busybox-w32-73dfdda92e20da718a9cb398ed762cc09c82e3a7.zip |
grep: make errors other than "not found" result in exit code 2. Closes 8796
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | findutils/grep.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 10b69275a..dece90c58 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -681,11 +681,15 @@ int grep_main(int argc UNUSED_PARAM, char **argv) | |||
681 | FILE *file; | 681 | FILE *file; |
682 | int matched; | 682 | int matched; |
683 | llist_t *fopt = NULL; | 683 | llist_t *fopt = NULL; |
684 | |||
685 | /* do normal option parsing */ | ||
686 | #if ENABLE_FEATURE_GREP_CONTEXT | 684 | #if ENABLE_FEATURE_GREP_CONTEXT |
687 | int Copt, opts; | 685 | int Copt, opts; |
686 | #endif | ||
688 | 687 | ||
688 | /* For grep, exitcode of 1 is "not found". Other errors are 2: */ | ||
689 | xfunc_error_retval = 2; | ||
690 | |||
691 | /* do normal option parsing */ | ||
692 | #if ENABLE_FEATURE_GREP_CONTEXT | ||
689 | /* -H unsets -h; -C unsets -A,-B; -e,-f are lists; | 693 | /* -H unsets -h; -C unsets -A,-B; -e,-f are lists; |
690 | * -m,-A,-B,-C have numeric param */ | 694 | * -m,-A,-B,-C have numeric param */ |
691 | opt_complementary = "H-h:C-AB:e::f::m+:A+:B+:C+"; | 695 | opt_complementary = "H-h:C-AB:e::f::m+:A+:B+:C+"; |