summaryrefslogtreecommitdiff
path: root/lib/libkvm
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2015-05-11 00:42:55 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2015-05-11 00:42:55 +0000
commitb8616fd26363ce287e8014cf0c2f2a5f5a8d3cf1 (patch)
treec1a8791e98cfc6bb2e9389049383738f47a0061e /lib/libkvm
parent6b2ba645c821fca1defaa24e42655cfaeed52507 (diff)
When checking flags that will be passed to open(), test the O_ACCMODE portion
separately to avoid false negatives. ok miod@ millert@
Diffstat (limited to 'lib/libkvm')
-rw-r--r--lib/libkvm/kvm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index ceeb2f6d6fa..ee97c433b16 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm.c,v 1.54 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: kvm.c,v 1.55 2015/05/11 00:42:54 guenther Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
@@ -198,7 +198,7 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
_kvm_err(kd, kd->program, "exec file name too long");
goto failed;
}
- if (flag & ~O_ACCMODE) {
+ if (flag != O_RDONLY && flag != O_WRONLY && flag != O_RDWR) {
_kvm_err(kd, kd->program, "bad flags arg");
goto failed;
}