diff options
author | nectar <nectar@FreeBSD.org> | 2000-03-31 15:04:25 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2000-03-31 15:04:25 +0000 |
commit | 4cb901960c0aeaed0bc980b0e65c3f6fa199f723 (patch) | |
tree | 34f3c88f5ba7b437a50448c0c5d4d7576fe74c4a /lib/libkvm/kvm.c | |
parent | 2bfd3498b2e3bba98b33d72ec1afa9ee016f8c84 (diff) | |
download | FreeBSD-src-4cb901960c0aeaed0bc980b0e65c3f6fa199f723.zip FreeBSD-src-4cb901960c0aeaed0bc980b0e65c3f6fa199f723.tar.gz |
Change the return value of kvm_read/kvm_write to be -1 on error, to
match the documented interface.
Previously it returned 0 on error.
PR: bin/10511
Diffstat (limited to 'lib/libkvm/kvm.c')
-rw-r--r-- | lib/libkvm/kvm.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index d8862c1..a4818b6 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 */ } |