diff options
author | 2019-06-28 13:32:41 +0000 | |
---|---|---|
committer | 2019-06-28 13:32:41 +0000 | |
commit | df69c215c7c66baf660f3f65414fd34796c96152 (patch) | |
tree | 0255639162b24c4a2f761a274e32b69c2256fd45 /lib/libkvm/kvm.c | |
parent | miniroot prototype disklabels should attempt to contain accurate (diff) | |
download | wireguard-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 'lib/libkvm/kvm.c')
-rw-r--r-- | lib/libkvm/kvm.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index f1d14a04cc2..610173686e3 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm.c,v 1.65 2018/05/03 16:42:07 zhuk Exp $ */ +/* $OpenBSD: kvm.c,v 1.66 2019/06/28 13:32:42 deraadt Exp $ */ /* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */ /*- @@ -219,11 +219,11 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf, if (mf == 0) mf = _PATH_MEM; - if ((kd->pmfd = open(mf, flag)) < 0) { + if ((kd->pmfd = open(mf, flag)) == -1) { _kvm_syserr(kd, kd->program, "%s", mf); goto failed; } - if (fstat(kd->pmfd, &st) < 0) { + if (fstat(kd->pmfd, &st) == -1) { _kvm_syserr(kd, kd->program, "%s", mf); goto failed; } @@ -239,12 +239,12 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf, "%s: not physical memory device", mf); goto failed; } - if ((kd->vmfd = open(_PATH_KMEM, flag)) < 0) { + if ((kd->vmfd = open(_PATH_KMEM, flag)) == -1) { _kvm_syserr(kd, kd->program, "%s", _PATH_KMEM); goto failed; } kd->alive = 1; - if (sf != NULL && (kd->swfd = open(sf, flag)) < 0) { + if (sf != NULL && (kd->swfd = open(sf, flag)) == -1) { _kvm_syserr(kd, kd->program, "%s", sf); goto failed; } |