diff -urN util-linux-2.11d.org/login-utils/login.c util-linux-2.11d/login-utils/login.c --- util-linux-2.11d.org/login-utils/login.c Sun May 20 22:27:44 2001 +++ util-linux-2.11d/login-utils/login.c Sun Jun 3 21:49:55 2001 @@ -156,7 +156,7 @@ #define SLEEP_EXIT_TIMEOUT 5 -#ifdef __linux__ +#ifndef __linux__ #define DO_PS_FIDDLING #endif @@ -515,8 +515,6 @@ tcsetattr(0,TCSAFLUSH,&tt); } - openlog("login", LOG_ODELAY, LOG_AUTHPRIV); - #if 0 /* other than iso-8859-1 */ printf("\033(K"); @@ -646,8 +644,12 @@ retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED); PAM_FAIL_CHECK; + openlog("login", LOG_ODELAY, LOG_AUTHPRIV); + #else /* ! USE_PAM */ + openlog("login", LOG_ODELAY, LOG_AUTHPRIV); + for (cnt = 0;; ask = 1) { # ifndef __linux__ ioctlval = 0; @@ -866,7 +868,9 @@ /* If we can't find a pre-existing entry by pid, try by line. BSD network daemons may rely on this. (anonymous) */ if (utp == NULL) { - setutent(); + endutent(); + setutent(); + memset(&ut, 0, sizeof(ut)); ut.ut_type = LOGIN_PROCESS; strncpy(ut.ut_id, tty_number, sizeof(ut.ut_id)); strncpy(ut.ut_line, tty_name, sizeof(ut.ut_line)); @@ -1103,6 +1107,8 @@ #endif signal(SIGINT, SIG_DFL); + openlog("login", LOG_ODELAY, LOG_AUTHPRIV); + /* discard permissions last so can't get killed and drop core */ if(setuid(pwd->pw_uid) < 0 && pwd->pw_uid) { syslog(LOG_ALERT, _("setuid() failed"));