Module Name:    src
Committed By:   christos
Date:           Thu Jun 23 22:50:54 UTC 2011

Modified Files:
        src/usr.bin/pmap: main.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.bin/pmap/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/pmap/main.c
diff -u src/usr.bin/pmap/main.c:1.20 src/usr.bin/pmap/main.c:1.21
--- src/usr.bin/pmap/main.c:1.20	Sun Apr 12 20:27:38 2009
+++ src/usr.bin/pmap/main.c	Thu Jun 23 18:50:53 2011
@@ -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) {

Reply via email to