lastlog: check for localtime() return value
Signed-off-by: Tomáš Mráz <tm@t8m.info> Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
parent
1e5f9a72b0
commit
fbf275da19
@ -150,9 +150,12 @@ static void print_one (/*@null@*/const struct passwd *pw)
|
||||
|
||||
ll_time = ll.ll_time;
|
||||
tm = localtime (&ll_time);
|
||||
if (tm == NULL) {
|
||||
cp = "(unknown)";
|
||||
} else {
|
||||
strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
|
||||
cp = ptime;
|
||||
|
||||
}
|
||||
if (ll.ll_time == (time_t) 0) {
|
||||
cp = _("**Never logged in**\0");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user