diff --git a/ChangeLog b/ChangeLog index f99b651f..02f6236d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-19 Paul Szabo + + * libmisc/utmp.c: Always call endutent or endutxent when setutent + or setutxent were used. + 2009-04-19 Nicolas François * src/login.c: Added comment to make sure PAM_RHOST or PAM_TTY do diff --git a/libmisc/utmp.c b/libmisc/utmp.c index 409a16d6..0c7a5d14 100644 --- a/libmisc/utmp.c +++ b/libmisc/utmp.c @@ -148,6 +148,8 @@ void checkutmp (bool picky) /* Sanitize / set the ut_line field */ strncpy (utent.ut_line, line, sizeof utent.ut_line); + + endutent (); } #elif defined(LOGIN_PROCESS) @@ -269,6 +271,11 @@ void checkutmp (bool picky) utent.ut_time = utxent.ut_tv.tv_sec; #endif } + +#if HAVE_UTMPX_H + endutxent (); +#endif + endutent (); } #endif @@ -442,6 +449,9 @@ int setutmp (const char *name, const char *line, const char *host) utxent = utxline; utent = utline; + endutxent (); + endutent (); + return err; }