rcolebaugh / rpms / bash

Forked from rpms/bash 2 years ago
Clone
b97725
diff --git a/builtins/history.def b/builtins/history.def
b97725
--- a/builtins/history.def
b97725
+++ b/builtins/history.def
b97725
@@ -256,10 +256,13 @@ histtime (hlist, histtimefmt)
b97725
 {
b97725
   static char timestr[128];
b97725
   time_t t;
b97725
+  struct tm *tm;
b97725
 
b97725
   t = history_get_time (hlist);
b97725
-  if (t)
b97725
-    strftime (timestr, sizeof (timestr), histtimefmt, localtime (&t);;
b97725
+
b97725
+  tm = t ? localtime (&t) : 0;
b97725
+  if (t && tm)
b97725
+    strftime (timestr, sizeof (timestr), histtimefmt, tm);
b97725
   else if (hlist->timestamp && hlist->timestamp[0])
b97725
     snprintf (timestr, sizeof (timestr), _("%s: invalid timestamp"),
b97725
 	(hlist->timestamp[0] == '#') ? hlist->timestamp + 1: hlist->timestamp);