summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoras145665 <none@none>2007-09-19 10:01:31 -0700
committeras145665 <none@none>2007-09-19 10:01:31 -0700
commit06fc3f99dd009e8cb3632e91d9f502de89b96c38 (patch)
tree13fb4002b2595a9ef2c0f5e0247b3f8ff874a1d2
parent29bc4795a563df76952f94da2aa3b7daa8abf972 (diff)
downloadillumos-joyent-06fc3f99dd009e8cb3632e91d9f502de89b96c38.tar.gz
6586939 Serial Console Sleeps on Exit while Desktop Console Is In Use
-rw-r--r--usr/src/cmd/ttymon/tmutmp.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/usr/src/cmd/ttymon/tmutmp.c b/usr/src/cmd/ttymon/tmutmp.c
index 28529def78..a59d9eec02 100644
--- a/usr/src/cmd/ttymon/tmutmp.c
+++ b/usr/src/cmd/ttymon/tmutmp.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -96,18 +95,21 @@ checkut_line(char *line)
struct utmpx *u;
char buf[33], ttyn[33];
int rvalue = 0;
+ pid_t ownpid = getpid();
(void) strncpy(buf, lastname(line), sizeof (u->ut_line));
buf[sizeof (u->ut_line)] = '\0';
setutxent();
while ((u = getutxent()) != NULL) {
- if (u->ut_type == USER_PROCESS) {
- strncpy(ttyn, u->ut_line, sizeof (u->ut_line));
- ttyn[sizeof (u->ut_line)] = '\0';
- if (strcmp(buf, ttyn) == 0) {
- rvalue = 1;
- break;
+ if (u->ut_pid == ownpid) {
+ if (u->ut_type == USER_PROCESS) {
+ strncpy(ttyn, u->ut_line, sizeof (u->ut_line));
+ ttyn[sizeof (u->ut_line)] = '\0';
+ if (strcmp(buf, ttyn) == 0) {
+ rvalue = 1;
+ break;
+ }
}
}
}