summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-23 23:19:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2004-02-23 23:19:10 +0000
commit71e364b476771e70e19a004b651223a6f4178f78 (patch)
tree6c5a2c5ad8f1bed706bc2dd64b09e16d9d33d3e3
parentee3d1615150f3790768fa258e4e505e22da46890 (diff)
more explicitly check against -1 for pread/pwrite error returns; millert ok
-rw-r--r--lib/libkvm/kvm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index 3b49134076f..7b98ecbaf53 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm.c,v 1.36 2004/02/18 03:23:00 tedu Exp $ */
+/* $OpenBSD: kvm.c,v 1.37 2004/02/23 23:19:09 deraadt Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#else
-static char *rcsid = "$OpenBSD: kvm.c,v 1.36 2004/02/18 03:23:00 tedu Exp $";
+static char *rcsid = "$OpenBSD: kvm.c,v 1.37 2004/02/23 23:19:09 deraadt Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -868,7 +868,7 @@ kvm_read(kd, kva, buf, len)
* device and let the active kernel do the address translation.
*/
cc = _kvm_pread(kd, kd->vmfd, buf, len, (off_t)kva);
- if (cc < 0) {
+ if (cc == -1) {
_kvm_err(kd, 0, "invalid address (%lx)", kva);
return (-1);
} else if (cc < len)
@@ -891,7 +891,7 @@ kvm_read(kd, kva, buf, len)
cc = len;
cc = _kvm_pread(kd, kd->pmfd, cp, cc,
(off_t)_kvm_pa2off(kd, pa));
- if (cc < 0) {
+ if (cc == -1) {
_kvm_syserr(kd, 0, _PATH_MEM);
break;
}
@@ -926,7 +926,7 @@ kvm_write(kd, kva, buf, len)
* Just like kvm_read, only we write.
*/
cc = _kvm_pwrite(kd, kd->vmfd, (void*)buf, (size_t)len, (off_t)kva);
- if (cc < 0) {
+ if (cc == -1) {
_kvm_err(kd, 0, "invalid address (%lx)", kva);
return (-1);
} else if (cc < len)