changeset 4099:9c9793408924

6547152 nwamd can't find graphical console user under gdm
author jbeck
date Tue, 24 Apr 2007 17:25:22 -0700
parents 0a182c2128e6
children bf306dd84529
files usr/src/cmd/cmd-inet/lib/nwamd/util.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/lib/nwamd/util.c	Tue Apr 24 16:07:37 2007 -0700
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/util.c	Tue Apr 24 17:25:22 2007 -0700
@@ -270,11 +270,15 @@
 	/*
 	 * Look for someone logged into the console from host ":0" (i.e.,
 	 * the X display.  Down the road, we should generalize this so
-	 * ":0" is not hard-coded.
+	 * ":0" is not hard-coded.  Note that the entry we want is usually
+	 * an ordinary user process but sometimes if a session leader has
+	 * exited, it can come from a DEAD_PROCESS, as is known to happen
+	 * when the user logs in via gdm(1m).
 	 */
 	setutxent();
 	while ((utp = getutxent()) != NULL) {
-		if ((utp->ut_type == USER_PROCESS) &&
+		if (((utp->ut_type == USER_PROCESS) ||
+		    (utp->ut_type == DEAD_PROCESS)) &&
 		    (strcmp(utp->ut_line, "console") == 0) &&
 		    (strcmp(utp->ut_host, ":0") == 0)) {
 			user = strdup(utp->ut_user);