Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libkvm initialise the kvm errbuf so that if an error occ...
details: https://anonhg.NetBSD.org/src/rev/498f78dbcc68
branches: trunk
changeset: 445594:498f78dbcc68
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Nov 05 00:43:30 2018 +0000
description:
initialise the kvm errbuf so that if an error occurs, but the
internal _kvm_*err() functions aren't called, stack garbage is
not reported as an error string.
call _kvm_err() if _kvm_kvatop() fails. now the above is not
triggered anymore :-)
diffstat:
lib/libkvm/kvm.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r 361099922697 -r 498f78dbcc68 lib/libkvm/kvm.c
--- a/lib/libkvm/kvm.c Sun Nov 04 21:41:12 2018 +0000
+++ b/lib/libkvm/kvm.c Mon Nov 05 00:43:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm.c,v 1.103 2018/02/07 14:03:18 maxv Exp $ */
+/* $NetBSD: kvm.c,v 1.104 2018/11/05 00:43:30 mrg Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)kvm.c 8.2 (Berkeley) 2/13/94";
#else
-__RCSID("$NetBSD: kvm.c,v 1.103 2018/02/07 14:03:18 maxv Exp $");
+__RCSID("$NetBSD: kvm.c,v 1.104 2018/11/05 00:43:30 mrg Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -255,6 +255,7 @@
kd->fdalign = 1;
kd->iobuf = NULL;
kd->iobufsz = 0;
+ kd->errbuf[0] = '\0';
if (flag & KVM_NO_FILES) {
kd->alive = KVM_ALIVE_SYSCTL;
@@ -851,8 +852,10 @@
off_t foff;
cc = _kvm_kvatop(kd, (vaddr_t)kva, &pa);
- if (cc == 0)
+ if (cc == 0) {
+ _kvm_err(kd, kd->program, "_kvm_kvatop(%lx)", kva);
return (-1);
+ }
if (cc > len)
cc = len;
foff = _kvm_pa2off(kd, pa);
Home |
Main Index |
Thread Index |
Old Index