summaryrefslogtreecommitdiff
path: root/src/login.c
diff options
context:
space:
mode:
authorSerge Hallyn <serge.hallyn@ubuntu.com>2016-09-18 22:14:43 -0500
committerSerge Hallyn <serge@hallyn.com>2016-10-13 10:19:55 -0500
commitd9e428fd63e49486c8fb0f2e03df7a5608b0b0e2 (patch)
treec42692274474b7a037c9c2ea24b793c2540c6a83 /src/login.c
parent68cd195044deb448c865d267499e1e4fd9322057 (diff)
parent3fcf082618704e4361653a2112cec97b8252a53e (diff)
downloadshadow-2016-10-13/d1.tar.gz
Imported Debian patch 1:4.4-12016-10-13/d1
Diffstat (limited to 'src/login.c')
-rw-r--r--src/login.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/login.c b/src/login.c
index d610844d..2d2e704e 100644
--- a/src/login.c
+++ b/src/login.c
@@ -103,7 +103,7 @@ static bool hflg = false;
static bool preauth_flag = false;
static bool amroot;
-static unsigned int timeout;
+static char tmsg[256];
/*
* External identifiers.
@@ -416,8 +416,8 @@ static void init_env (void)
static RETSIGTYPE alarm_handler (unused int sig)
{
- fprintf (stderr, _("\nLogin timed out after %u seconds.\n"), timeout);
- exit (0);
+ write (STDERR_FILENO, tmsg, strlen (tmsg));
+ _exit (0);
}
#ifdef USE_PAM
@@ -532,6 +532,7 @@ int main (int argc, char **argv)
bool is_console;
#endif
int err;
+ unsigned int timeout;
const char *cp;
const char *tmp;
char fromhost[512];
@@ -698,8 +699,10 @@ int main (int argc, char **argv)
top:
/* only allow ALARM sec. for login */
- (void) signal (SIGALRM, alarm_handler);
timeout = getdef_unum ("LOGIN_TIMEOUT", ALARM);
+ snprintf (tmsg, sizeof tmsg,
+ _("\nLogin timed out after %u seconds.\n"), timeout);
+ (void) signal (SIGALRM, alarm_handler);
if (timeout > 0) {
(void) alarm (timeout);
}