From: Chet Ramey Date: Mon, 28 Sep 2015 17:58:03 +0000 (-0400) Subject: commit readline-20150925 snapshot X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc1682929ed47d94ad481de8643dbca3d6908ba5;p=thirdparty%2Freadline.git commit readline-20150925 snapshot --- 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; }