diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
commit | 86ffccf24f66032a89d70a32b3609584c0db7345 (patch) | |
tree | 2ae97fac6ea5be57cc953baf8612e8f683da0172 /usr.sbin/hostctl | |
parent | ce9fea47562d4f179d45680d6aec00ede2877141 (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.sbin/hostctl')
-rw-r--r-- | usr.sbin/hostctl/hostctl.c | 6 |
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)) { |