* libmisc/utmp.c: Always call endutent or endutxent when setutent

or setutxent were used.
This commit is contained in:
nekral-guest 2009-04-19 15:28:38 +00:00
parent 8156c3b0be
commit 2ed05e548b
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2009-04-19 Paul Szabo <psz@maths.usyd.edu.au>
* libmisc/utmp.c: Always call endutent or endutxent when setutent
or setutxent were used.
2009-04-19 Nicolas François <nicolas.francois@centraliens.net> 2009-04-19 Nicolas François <nicolas.francois@centraliens.net>
* src/login.c: Added comment to make sure PAM_RHOST or PAM_TTY do * src/login.c: Added comment to make sure PAM_RHOST or PAM_TTY do

View File

@ -148,6 +148,8 @@ void checkutmp (bool picky)
/* Sanitize / set the ut_line field */ /* Sanitize / set the ut_line field */
strncpy (utent.ut_line, line, sizeof utent.ut_line); strncpy (utent.ut_line, line, sizeof utent.ut_line);
endutent ();
} }
#elif defined(LOGIN_PROCESS) #elif defined(LOGIN_PROCESS)
@ -269,6 +271,11 @@ void checkutmp (bool picky)
utent.ut_time = utxent.ut_tv.tv_sec; utent.ut_time = utxent.ut_tv.tv_sec;
#endif #endif
} }
#if HAVE_UTMPX_H
endutxent ();
#endif
endutent ();
} }
#endif #endif
@ -442,6 +449,9 @@ int setutmp (const char *name, const char *line, const char *host)
utxent = utxline; utxent = utxline;
utent = utline; utent = utline;
endutxent ();
endutent ();
return err; return err;
} }