diff options
author | 2003-07-10 17:02:48 +0000 | |
---|---|---|
committer | 2003-07-10 17:02:48 +0000 | |
commit | f91b52265e9562a7242f802318e282bfbcbc9d88 (patch) | |
tree | 28f7a02e0a8682ad138ec80c20a6e99923bc77b3 /usr.bin/grep/grep.c | |
parent | knf (diff) | |
download | wireguard-openbsd-f91b52265e9562a7242f802318e282bfbcbc9d88.tar.xz wireguard-openbsd-f91b52265e9562a7242f802318e282bfbcbc9d88.zip |
grep should exit(2) on error, not exit(1) (1 means no matches found).
deraadt@ OK
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r-- | usr.bin/grep/grep.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index 939a706491d..6cfa2f7f61c 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.19 2003/07/10 16:51:12 deraadt Exp $ */ +/* $OpenBSD: grep.c,v 1.20 2003/07/10 17:02:48 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -190,7 +190,7 @@ read_patterns(char *fn) int nl; if ((f = fopen(fn, "r")) == NULL) - err(1, "%s", fn); + err(2, "%s", fn); nl = 0; while ((line = fgetln(f, &len)) != NULL) { if (*line == '\n') { @@ -205,7 +205,7 @@ read_patterns(char *fn) add_pattern(line, len); } if (ferror(f)) - err(1, "%s", fn); + err(2, "%s", fn); fclose(f); } @@ -426,7 +426,7 @@ main(int argc, char *argv[]) if ((c = regcomp(&r_pattern[i], pattern[i], cflags))) { regerror(c, &r_pattern[i], re_error, RE_ERROR_BUF); - errx(1, "%s", re_error); + errx(2, "%s", re_error); } } } |