]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
commit readline-20150925 snapshot
authorChet Ramey <chet.ramey@case.edu>
Mon, 28 Sep 2015 17:58:03 +0000 (13:58 -0400)
committerChet Ramey <chet.ramey@case.edu>
Mon, 28 Sep 2015 17:58:03 +0000 (13:58 -0400)
history.c

index 92398db7c2dd58eea6a03632f5e9effca0904554..a0b12e1d1686cce2c00c890a95dc7a7a7c9a27a0 100644 (file)
--- a/history.c
+++ b/history.c
 #  include <unistd.h>
 #endif
 
+#include <errno.h>
+
 #include "history.h"
 #include "histlib.h"
 
 #include "xmalloc.h"
 
+#if !defined (errno)
+extern int errno;
+#endif
+
 /* How big to make the_history when we first allocate it. */
 #define DEFAULT_HISTORY_INITIAL_SIZE   502
 
@@ -239,7 +245,10 @@ history_get_time (hist)
   ts = hist->timestamp;
   if (ts[0] != history_comment_char)
     return 0;
+  errno = 0;
   t = (time_t) strtol (ts + 1, (char **)NULL, 10);             /* XXX - should use strtol() here */
+  if (errno == ERANGE)
+    return (time_t)0;
   return t;
 }