summaryrefslogtreecommitdiffstats
path: root/usr.sbin/kvm_mkdb
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:32:41 +0000
commitdf69c215c7c66baf660f3f65414fd34796c96152 (patch)
tree0255639162b24c4a2f761a274e32b69c2256fd45 /usr.sbin/kvm_mkdb
parentminiroot prototype disklabels should attempt to contain accurate (diff)
downloadwireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz
wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip
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.sbin/kvm_mkdb')
-rw-r--r--usr.sbin/kvm_mkdb/kvm_mkdb.c4
-rw-r--r--usr.sbin/kvm_mkdb/nlist.c4
-rw-r--r--usr.sbin/kvm_mkdb/testdb.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c
index 64765679058..bda0080948e 100644
--- a/usr.sbin/kvm_mkdb/kvm_mkdb.c
+++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mkdb.c,v 1.30 2018/10/26 17:11:33 mestre Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.31 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
/* Increase our data size to the max if we can. */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
warn("can't set rlimit data size");
}
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c
index 7745642103e..cd8c01b3bad 100644
--- a/usr.sbin/kvm_mkdb/nlist.c
+++ b/usr.sbin/kvm_mkdb/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.52 2018/04/26 12:42:51 guenther Exp $ */
+/* $OpenBSD: nlist.c,v 1.53 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -90,7 +90,7 @@ __elf_knlist(int fd, DB *db, int ksyms)
errx(1, "cannot allocate %zu bytes for symbol header",
sizeof(Elf_Shdr) * eh.e_shnum);
- if (fseek (fp, eh.e_shoff, SEEK_SET) < 0) {
+ if (fseek(fp, eh.e_shoff, SEEK_SET) == -1) {
fmterr = "no exec header";
error = -1;
goto done;
diff --git a/usr.sbin/kvm_mkdb/testdb.c b/usr.sbin/kvm_mkdb/testdb.c
index a804634e61c..649a7d1c4f9 100644
--- a/usr.sbin/kvm_mkdb/testdb.c
+++ b/usr.sbin/kvm_mkdb/testdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: testdb.c,v 1.9 2015/01/16 06:40:17 deraadt Exp $ */
+/* $OpenBSD: testdb.c,v 1.10 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@ testdb(char *dbname)
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
kversionlen = sizeof(kversion);
- if (sysctl(mib, 2, kversion, &kversionlen, NULL, 0) < 0)
+ if (sysctl(mib, 2, kversion, &kversionlen, NULL, 0) == -1)
goto close;
/* Read the version out of the database */