Source-Changes-HG archive

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

[src/trunk]: src/bin/ps getkinfo_kvm(): fix bug in previous - handled size_t ...



details:   https://anonhg.NetBSD.org/src/rev/6f39f0cbf5ce
branches:  trunk
changeset: 477214:6f39f0cbf5ce
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Oct 15 20:01:33 1999 +0000

description:
getkinfo_kvm(): fix bug in previous - handled size_t i as if it would be signed
saveuser(): don't check kd - if we get here, kd is never NULL

diffstat:

 bin/ps/ps.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 696a8b396fb5 -r 6f39f0cbf5ce bin/ps/ps.c
--- a/bin/ps/ps.c       Fri Oct 15 19:31:24 1999 +0000
+++ b/bin/ps/ps.c       Fri Oct 15 20:01:33 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ps.c,v 1.29 1999/10/15 19:31:25 jdolecek Exp $ */
+/*     $NetBSD: ps.c,v 1.30 1999/10/15 20:01:33 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)ps.c       8.4 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: ps.c,v 1.29 1999/10/15 19:31:25 jdolecek Exp $");
+__RCSID("$NetBSD: ps.c,v 1.30 1999/10/15 20:01:33 jdolecek Exp $");
 #endif
 #endif /* not lint */
 
@@ -411,7 +411,7 @@
        {
                if ((kinfo = malloc((*nentriesp) * sizeof(*kinfo))) == NULL)
                        err(1, "%s", "");
-               for (i = *nentriesp; --i >= 0; ++kp) {
+               for (i = (*nentriesp); i-- > 0; kp++) {
                        kinfo[i].ki_p = kp;
                        if (needuser)
                                saveuser(&kinfo[i]);
@@ -450,7 +450,7 @@
        struct usave *usp;
 
        usp = &ki->ki_u;
-       if (kd && kvm_read(kd, (u_long)&KI_PROC(ki)->p_addr->u_stats,
+       if (kvm_read(kd, (u_long)&KI_PROC(ki)->p_addr->u_stats,
            (char *)&pstats, sizeof(pstats)) == sizeof(pstats)) {
                /*
                 * The u-area might be swapped out, and we can't get



Home | Main Index | Thread Index | Old Index