diff options
Diffstat (limited to 'src/login.c')
-rw-r--r-- | src/login.c | 11 |
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); } |