utmp: call prepare_utmp() even if utent is NULL
update_utmp() should also return 0 when success.
Fixes: 1f368e1c18 ("utmp: update
`update_utmp()")
Resolves: https://github.com/shadow-maint/shadow/issues/805
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
committed by
Serge Hallyn
parent
bef4da47be
commit
5178f8c5af
11
lib/utmp.c
11
lib/utmp.c
@@ -370,17 +370,16 @@ int update_utmp (const char *user,
|
||||
struct utmp *utent, *ut;
|
||||
|
||||
utent = get_current_utmp ();
|
||||
if (utent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ut = prepare_utmp (user, tty, host, utent);
|
||||
|
||||
(void) setutmp (ut); /* make entry in the utmp & wtmp files */
|
||||
free (utent);
|
||||
|
||||
if (utent != NULL) {
|
||||
free (utent);
|
||||
}
|
||||
free (ut);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void record_failure(const char *failent_user,
|
||||
|
||||
Reference in New Issue
Block a user