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/rcs/diff.c | |
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/rcs/diff.c')
-rw-r--r-- | usr.bin/rcs/diff.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c index 868288cf9f6..ad39a3c4663 100644 --- a/usr.bin/rcs/diff.c +++ b/usr.bin/rcs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.39 2016/10/16 13:35:51 okan Exp $ */ +/* $OpenBSD: diff.c,v 1.40 2019/06/28 13:35:03 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -327,12 +327,12 @@ diffreg(const char *file1, const char *file2, BUF *out, int flags) goto closem; } - if (fstat(fileno(f1), &stb1) < 0) { + if (fstat(fileno(f1), &stb1) == -1) { warn("%s", file1); goto closem; } - if (fstat(fileno(f2), &stb2) < 0) { + if (fstat(fileno(f2), &stb2) == -1) { warn("%s", file2); goto closem; } @@ -849,7 +849,7 @@ preadline(int fd, size_t rlen, off_t off) ssize_t nr; line = xmalloc(rlen + 1); - if ((nr = pread(fd, line, rlen, off)) < 0) + if ((nr = pread(fd, line, rlen, off)) == -1) err(D_ERROR, "preadline"); line[nr] = '\0'; return (line); |