summaryrefslogtreecommitdiff
path: root/sfeed_frames.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-07 21:23:58 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-07 21:23:58 +0200
commite46ef96d680fe3d720a54ff1c178cce03d3a980a (patch)
tree052ae110151e7f27607a8eab79c6b8a16f89f135 /sfeed_frames.c
parentf23af0821309e86d9d6db59796d245b6986e2cd3 (diff)
util: strtotime: stricter time parsing
as input: an empty string or non-digit characters are digits are considered an error now. Still, for the format tools output the formatted time string as time_t 0 on a parse error.
Diffstat (limited to 'sfeed_frames.c')
-rw-r--r--sfeed_frames.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c
index e5252a5..70c531d 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -105,8 +105,7 @@ static void
printfeed(FILE *fpitems, FILE *fpin, struct feed *f)
{
char dirpath[PATH_MAX], filepath[PATH_MAX];
- char *fields[FieldLast], *feedname;
- char name[128];
+ char *fields[FieldLast], *feedname, name[128];
size_t namelen;
struct stat st;
FILE *fpcontent = NULL;
@@ -177,14 +176,14 @@ printfeed(FILE *fpitems, FILE *fpin, struct feed *f)
}
/* set modified and access time of file to time of item. */
- r = strtotime(fields[FieldUnixTimestamp], &parsedtime);
- if (r != -1) {
+ parsedtime = 0;
+ if (strtotime(fields[FieldUnixTimestamp], &parsedtime) != -1) {
contenttime.actime = parsedtime;
contenttime.modtime = parsedtime;
utime(filepath, &contenttime);
}
- isnew = (r != -1 && parsedtime >= comparetime) ? 1 : 0;
+ isnew = (parsedtime >= comparetime) ? 1 : 0;
totalnew += isnew;
f->totalnew += isnew;
f->total++;