diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index d8862c1137b3..a4818b6fce87 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -375,12 +375,12 @@ kvm_read(kd, kva, buf, len) errno = 0; if (lseek(kd->vmfd, (off_t)kva, 0) == -1 && errno != 0) { _kvm_err(kd, 0, "invalid address (%x)", kva); - return (0); + return (-1); } cc = read(kd->vmfd, buf, len); if (cc < 0) { _kvm_syserr(kd, 0, "kvm_read"); - return (0); + return (-1); } else if (cc < len) _kvm_err(kd, kd->program, "short read"); return (cc); @@ -391,7 +391,7 @@ kvm_read(kd, kva, buf, len) cc = _kvm_kvatop(kd, kva, &pa); if (cc == 0) - return (0); + return (-1); if (cc > len) cc = len; errno = 0; @@ -437,19 +437,19 @@ kvm_write(kd, kva, buf, len) errno = 0; if (lseek(kd->vmfd, (off_t)kva, 0) == -1 && errno != 0) { _kvm_err(kd, 0, "invalid address (%x)", kva); - return (0); + return (-1); } cc = write(kd->vmfd, buf, len); if (cc < 0) { _kvm_syserr(kd, 0, "kvm_write"); - return (0); + return (-1); } else if (cc < len) _kvm_err(kd, kd->program, "short write"); return (cc); } else { _kvm_err(kd, kd->program, "kvm_write not implemented for dead kernels"); - return (0); + return (-1); } /* NOTREACHED */ }