changeset 7007:80e769ddeb00

6711774 Consoles without write permission are unresponsive to <RET> but respond to other key inputs.
author dtse
date Wed, 02 Jul 2008 10:25:00 -0700
parents 91d884ce1092
children 8f7bd4ba8aeb
files usr/src/cmd/vntsd/read.c
diffstat 1 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/vntsd/read.c	Wed Jul 02 08:54:52 2008 -0700
+++ b/usr/src/cmd/vntsd/read.c	Wed Jul 02 10:25:00 2008 -0700
@@ -21,7 +21,7 @@
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -225,21 +225,30 @@
 		}
 
 		assert(clientp->cons);
-		if (clientp->cons->clientpq->handle != clientp) {
-			/* reader - print  error message */
-			if ((c != CR) && (c != LF)) {
-				rv = vntsd_write_line(clientp,
-				    gettext(VNTSD_NO_WRITE_ACCESS_MSG));
 
-				/* check errors and may exit */
-				if (rv == VNTSD_STATUS_INTR) {
-					rv = vntsd_cons_chk_intr(clientp);
-				}
+		/*
+		 * Only keyboard inputs from first connection to a
+		 * guest console should be accepted.  Check to see if
+		 * this client is the first connection in console
+		 * queue
+		 */
+		if (clientp->cons->clientpq->handle != clientp) {
+			/*
+			 * Since this console connection is not the first
+			 * connection in the console queue,
+			 * it is operating in 'reader'
+			 * mode, print warning and ignore the input.
+			 */
+			rv = vntsd_write_line(clientp,
+			    gettext(VNTSD_NO_WRITE_ACCESS_MSG));
 
-				if (rv != VNTSD_SUCCESS) {
-					return (rv);
-				}
+			/* check errors and interrupts */
+			if (rv == VNTSD_STATUS_INTR) {
+				rv = vntsd_cons_chk_intr(clientp);
+			}
 
+			if (rv != VNTSD_SUCCESS) {
+				return (rv);
 			}
 
 			continue;