Don't drop the last character from ut_line in ID0logout().

PR:		35531
MFC after:	2 weeks
This commit is contained in:
Brian Somers 2002-03-05 13:03:11 +00:00
parent e3cd129613
commit b84271d866

View File

@ -220,17 +220,18 @@ void
ID0logout(const char *device, int nologout)
{
struct utmp ut;
char ut_line[sizeof ut.ut_line + 1];
strncpy(ut.ut_line, device, sizeof ut.ut_line - 1);
ut.ut_line[sizeof ut.ut_line - 1] = '\0';
strncpy(ut_line, device, sizeof ut_line - 1);
ut_line[sizeof ut_line - 1] = '\0';
ID0set0();
if (nologout || logout(ut.ut_line)) {
log_Printf(LogID0, "logout(\"%s\")\n", ut.ut_line);
logwtmp(ut.ut_line, "", "");
log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut.ut_line);
if (nologout || logout(ut_line)) {
log_Printf(LogID0, "logout(\"%s\")\n", ut_line);
logwtmp(ut_line, "", "");
log_Printf(LogID0, "logwtmp(\"%s\", \"\", \"\")\n", ut_line);
} else
log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut.ut_line);
log_Printf(LogERROR, "ID0logout: No longer logged in on %s\n", ut_line);
ID0setuser();
}