summaryrefslogtreecommitdiffstats
path: root/usr.sbin/hostctl
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/hostctl
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/hostctl')
-rw-r--r--usr.sbin/hostctl/hostctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/hostctl/hostctl.c b/usr.sbin/hostctl/hostctl.c
index dbaf1eb0d6c..f0639dd55f3 100644
--- a/usr.sbin/hostctl/hostctl.c
+++ b/usr.sbin/hostctl/hostctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostctl.c,v 1.4 2018/07/03 16:42:51 sf Exp $ */
+/* $OpenBSD: hostctl.c,v 1.5 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2016 Reyk Floeter <reyk@openbsd.org>
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
err(1, "calloc");
if (tflag) {
- if (ioctl(fd, PVBUSIOC_TYPE, &pvr, sizeof(pvr)) != 0)
+ if (ioctl(fd, PVBUSIOC_TYPE, &pvr, sizeof(pvr)) == -1)
err(1, "ioctl");
/* The returned type should be a simple single-line key */
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
err(1, "open: %s", path_pvbus);
}
- if ((ret = ioctl(fd, cmd, &pvr, sizeof(pvr))) != 0)
+ if ((ret = ioctl(fd, cmd, &pvr, sizeof(pvr))) == -1)
err(1, "ioctl");
if (!qflag && strlen(pvr.pvr_value)) {