Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/vmstat Don't crash on old kernels that don't have th...



details:   https://anonhg.NetBSD.org/src/rev/abd8879f48fb
branches:  trunk
changeset: 760057:abd8879f48fb
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Dec 25 14:18:37 2010 +0000

description:
Don't crash on old kernels that don't have the new per cpu counters.

diffstat:

 usr.bin/vmstat/vmstat.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 2896d30f15a4 -r abd8879f48fb usr.bin/vmstat/vmstat.c
--- a/usr.bin/vmstat/vmstat.c   Sat Dec 25 14:06:14 2010 +0000
+++ b/usr.bin/vmstat/vmstat.c   Sat Dec 25 14:18:37 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.172 2010/12/24 23:39:19 enami Exp $ */
+/* $NetBSD: vmstat.c,v 1.173 2010/12/25 14:18:37 christos Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
 #if 0
 static char sccsid[] = "@(#)vmstat.c   8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.172 2010/12/24 23:39:19 enami Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.173 2010/12/25 14:18:37 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -983,7 +983,8 @@
                    != sizeof(tci)) {
                    warnx("Can't read cpu info from %p (%s)",
                        ci, kvm_geterr(kd));
-                   continue;
+                   (void)memset(cc, 0, sizeof(*cc));
+                   return;
                }
                /* Found the fake element, done */
                if (tci.ci_data.cpu_qchain.cqe_prev == NULL)



Home | Main Index | Thread Index | Old Index