nalika / rpms / bash

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