diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2018-03-05 16:53:40 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2018-03-05 16:53:40 +0000 |
commit | 11ac39bb26cf4cd4a9ba55c2aed6eaf4b038e7c1 (patch) | |
tree | 9d3ccf7331a1e336223cb76e3df9f1f5d49ed1d5 /usr.bin/cmp/special.c | |
parent | c47b38b25549b2bc07e204030c4cd5827ea17af2 (diff) |
Add fatal() and fatalx() and put them to use.
... but don't use them for pledge errors or usage errors.
They are convenience wrappers that check if sflag is set before
logging an error. They always exit with status 2.
We were not honoring sflag in special.c at all. Now we do.
ok tb@
Diffstat (limited to 'usr.bin/cmp/special.c')
-rw-r--r-- | usr.bin/cmp/special.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index c7b747598fd..d6896f4f3b7 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -1,4 +1,4 @@ -/* $OpenBSD: special.c,v 1.7 2011/01/19 13:01:25 okan Exp $ */ +/* $OpenBSD: special.c,v 1.8 2018/03/05 16:53:39 cheloha Exp $ */ /* $NetBSD: special.c,v 1.2 1995/09/08 03:23:00 tls Exp $ */ /*- @@ -48,9 +48,9 @@ c_special(int fd1, char *file1, off_t skip1, int fd2, char *file2, off_t skip2) int dfound; if ((fp1 = fdopen(fd1, "r")) == NULL) - err(ERR_EXIT, "%s", file1); + fatal("%s", file1); if ((fp2 = fdopen(fd2, "r")) == NULL) - err(ERR_EXIT, "%s", file2); + fatal("%s", file2); dfound = 0; while (skip1--) @@ -79,9 +79,9 @@ c_special(int fd1, char *file1, off_t skip1, int fd2, char *file2, off_t skip2) } eof: if (ferror(fp1)) - err(ERR_EXIT, "%s", file1); + fatal("%s", file1); if (ferror(fp2)) - err(ERR_EXIT, "%s", file2); + fatal("%s", file2); if (feof(fp1)) { if (!feof(fp2)) eofmsg(file1); |