diff options
author | Karel Zak | 2006-12-07 00:26:12 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:12 +0100 |
commit | df1dddf9ffcfc1e291de809c0e8b9060bfea02ee (patch) | |
tree | 03b712bddec33d05754bf59d31a75d7e2022761e /login-utils | |
parent | Imported from util-linux-2.11y tarball. (diff) | |
download | kernel-qcow2-util-linux-df1dddf9ffcfc1e291de809c0e8b9060bfea02ee.tar.gz kernel-qcow2-util-linux-df1dddf9ffcfc1e291de809c0e8b9060bfea02ee.tar.xz kernel-qcow2-util-linux-df1dddf9ffcfc1e291de809c0e8b9060bfea02ee.zip |
Imported from util-linux-2.12 tarball.
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/login.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/login-utils/login.c b/login-utils/login.c index 8088878a5..da9b72fde 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1252,17 +1252,35 @@ getloginname(void) { } #endif -void -timedout(int sig) { - struct termio ti; - - fprintf(stderr, _("Login timed out after %d seconds\n"), timeout); +/* + * Robert Ambrose writes: + * A couple of my users have a problem with login processes hanging around + * soaking up pts's. What they seem to hung up on is trying to write out the + * message 'Login timed out after %d seconds' when the connection has already + * been dropped. + * What I did was add a second timeout while trying to write the message so + * the process just exits if the second timeout expires. + */ + +static void +timedout2(int sig) { + struct termio ti; - /* reset echo */ - ioctl(0, TCGETA, &ti); - ti.c_lflag |= ECHO; - ioctl(0, TCSETA, &ti); - exit(0); /* %% */ + /* reset echo */ + ioctl(0, TCGETA, &ti); + ti.c_lflag |= ECHO; + ioctl(0, TCSETA, &ti); + exit(0); /* %% */ +} + +static void +timedout(int sig) { + signal(SIGALRM, timedout2); + alarm(10); + fprintf(stderr, _("Login timed out after %d seconds\n"), timeout); + signal(SIGALRM, SIG_IGN); + alarm(0); + timedout2(0); } #ifndef USE_PAM |