From bc1682929ed47d94ad481de8643dbca3d6908ba5 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 28 Sep 2015 13:58:03 -0400 Subject: [PATCH] commit readline-20150925 snapshot --- history.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/history.c b/history.c index 92398db..a0b12e1 100644 --- a/history.c +++ b/history.c @@ -43,11 +43,17 @@ # include #endif +#include + #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; } -- 2.47.3