changeset 13235:f5d04b62b0f0

350 pfiles crashes when inspecting itself Reviewed by: garrett@nexenta.com Approved by: gwr@nexenta.com
author Richard Lowe <richlowe@richlowe.net>
date Wed, 20 Oct 2010 02:56:21 -0400
parents 8157e74f6c4d
children 21499d6cbb4a
files usr/src/cmd/ptools/pfiles/pfiles.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/ptools/pfiles/pfiles.c	Fri Nov 05 17:40:20 2010 -0400
+++ b/usr/src/cmd/ptools/pfiles/pfiles.c	Wed Oct 20 02:56:21 2010 -0400
@@ -354,7 +354,11 @@
 #ifdef _LP64
 	struct flock64_32 flock_target;
 
-	if (Pstatus(Pr)->pr_dmodel == PR_MODEL_ILP32) {
+	/*
+	 * Pr may be NULL when pfiles is inspecting itself, but in that case
+	 * we already know the data model of the two processes must match.
+	 */
+	if ((Pr != NULL) && (Pstatus(Pr)->pr_dmodel == PR_MODEL_ILP32)) {
 		copyflock(flock_target, *flock_native);
 		ret = pr_fcntl(Pr, fd, F_GETLK, &flock_target);
 		copyflock(*flock_native, flock_target);