summaryrefslogtreecommitdiff
path: root/login-utils
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2006-12-07 00:26:12 +0100
committerKarel Zak <kzak@redhat.com>2006-12-07 00:26:12 +0100
commitdf1dddf9ffcfc1e291de809c0e8b9060bfea02ee (patch)
tree03b712bddec33d05754bf59d31a75d7e2022761e /login-utils
parenta5a16c68537f8c3e5e61c5fb1680ee9f82b70a4d (diff)
downloadutil-linux-old-df1dddf9ffcfc1e291de809c0e8b9060bfea02ee.tar.gz
Imported from util-linux-2.12 tarball.
Diffstat (limited to 'login-utils')
-rw-r--r--login-utils/login.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index 8088878a..da9b72fd 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