diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
commit | 61656abc7ff84215165af1bd464bc053b3b66158 (patch) | |
tree | c7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/compress | |
parent | 18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (diff) |
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
Diffstat (limited to 'usr.bin/compress')
-rw-r--r-- | usr.bin/compress/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/compress/main.c b/usr.bin/compress/main.c index 471b7051a69..c7b2cc8efda 100644 --- a/usr.bin/compress/main.c +++ b/usr.bin/compress/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.95 2019/05/27 15:11:01 millert Exp $ */ +/* $OpenBSD: main.c,v 1.96 2019/06/28 13:35:00 deraadt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -499,7 +499,7 @@ docompress(const char *in, char *out, const struct compressor *method, ifd = dup(STDIN_FILENO); else ifd = open(in, O_RDONLY); - if (ifd < 0) { + if (ifd == -1) { if (verbose >= 0) warn("%s", in); return (FAILURE); @@ -517,7 +517,7 @@ docompress(const char *in, char *out, const struct compressor *method, } ofd = open(out, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR); } - if (ofd < 0) { + if (ofd == -1) { if (verbose >= 0) warn("%s", out); (void) close(ifd); @@ -636,7 +636,7 @@ dodecompress(const char *in, char *out, struct stat *sb) ifd = dup(STDIN_FILENO); else ifd = open(in, O_RDONLY); - if (ifd < 0) { + if (ifd == -1) { if (verbose >= 0) warn("%s", in); return -1; @@ -691,7 +691,7 @@ dodecompress(const char *in, char *out, struct stat *sb) } ofd = open(out, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR); } - if (ofd < 0) { + if (ofd == -1) { if (verbose >= 0) warn("%s", in); method->close(cookie, NULL, NULL, NULL); |