diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-06-28 15:38:48 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2014-06-28 15:38:48 +0200 |
commit | 97a069df32404705b9c5782cae338a0ea39f4535 (patch) | |
tree | 3e7a28980945bdf27a3312b8223af321ae262d6e /sfeed_plain.c | |
parent | af2d105e1e48c593e3536fecbd251671f81ccf9c (diff) |
handle invalid values of strto*l
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat (limited to 'sfeed_plain.c')
-rw-r--r-- | sfeed_plain.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sfeed_plain.c b/sfeed_plain.c index ca5756b..f57a8c8 100644 --- a/sfeed_plain.c +++ b/sfeed_plain.c @@ -2,6 +2,7 @@ #include <string.h> #include <stdlib.h> #include <time.h> +#include <errno.h> #include "util.h" @@ -27,7 +28,10 @@ main(void) { comparetime = time(NULL) - (3600 * 24); /* 1 day is old news */ while(parseline(&line, &size, fields, FieldLast, '\t', stdin) > 0) { + errno = 0; parsedtime = (time_t)strtol(fields[FieldUnixTimestamp], NULL, 10); + if(errno != 0) + parsedtime = 0; if(parsedtime >= comparetime) fputs(" N ", stdout); else |