Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/pmap Don't give out information about processes we c...



details:   https://anonhg.NetBSD.org/src/rev/32d6dbbe9aba
branches:  trunk
changeset: 766491:32d6dbbe9aba
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Jun 23 22:50:53 2011 +0000

description:
Don't give out information about processes we can't control.

diffstat:

 usr.bin/pmap/main.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r 73d505bfaf7f -r 32d6dbbe9aba usr.bin/pmap/main.c
--- a/usr.bin/pmap/main.c       Thu Jun 23 20:54:24 2011 +0000
+++ b/usr.bin/pmap/main.c       Thu Jun 23 22:50:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.20 2009/04/13 00:27:38 lukem Exp $ */
+/*     $NetBSD: main.c,v 1.21 2011/06/23 22:50:53 christos Exp $ */
 
 /*
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.20 2009/04/13 00:27:38 lukem Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2011/06/23 22:50:53 christos Exp $");
 #endif
 
 #include <sys/param.h>
@@ -47,6 +47,7 @@
 #include <unistd.h>
 #include <limits.h>
 #include <string.h>
+#include <signal.h>
 
 #include "pmap.h"
 #include "main.h"
@@ -311,6 +312,11 @@
                if (pid == 0)
                        kproc = NULL;
                else {
+                       if (kill(pid, 0) == -1) {
+                               warn("%d", pid);
+                               pid = -1;
+                               continue;
+                       }
                        kproc = kvm_getproc2(kd, KERN_PROC_PID, pid,
                                             sizeof(struct kinfo_proc2), &rc);
                        if (kproc == NULL || rc == 0) {



Home | Main Index | Thread Index | Old Index