summaryrefslogtreecommitdiffstats
path: root/login-utils/utmpdump.c
diff options
context:
space:
mode:
Diffstat (limited to 'login-utils/utmpdump.c')
-rw-r--r--login-utils/utmpdump.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/login-utils/utmpdump.c b/login-utils/utmpdump.c
index 7611c9f0a..e1fefc63e 100644
--- a/login-utils/utmpdump.c
+++ b/login-utils/utmpdump.c
@@ -48,9 +48,10 @@
static char *timetostr(const time_t time)
{
static char s[29]; /* [Sun Sep 01 00:00:00 1998 PST] */
+ struct tm *tmp;
- if (time != 0)
- strftime(s, 29, "%a %b %d %T %Y %Z", localtime(&time));
+ if (time != 0 && (tmp = localtime(&time)))
+ strftime(s, 29, "%a %b %d %T %Y %Z", tmp);
else
s[0] = '\0';