sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 6bb38b0df57c58c2f8088d990a28f2b2a8a87196
parent a06b706edd825e766b732b8b7b83bc9dcc0d4215
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 30 Jul 2015 16:09:54 +0200

check for time() failure

Diffstat:
Msfeed_frames.c | 4+++-
Msfeed_html.c | 5+++--
Msfeed_plain.c | 4+++-
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sfeed_frames.c b/sfeed_frames.c @@ -161,8 +161,10 @@ main(int argc, char *argv[]) if (!(feeds = calloc(argc, sizeof(struct feed *)))) err(1, "calloc"); + if ((comparetime = time(NULL)) == -1) + err(1, "time"); /* 1 day is old news */ - comparetime = time(NULL) - 86400; + comparetime -= 86400; /* write main index page */ if (!(fpindex = fopen("index.html", "w+b"))) diff --git a/sfeed_html.c b/sfeed_html.c @@ -75,9 +75,10 @@ main(int argc, char *argv[]) if (!(feeds = calloc(argc, sizeof(struct feed *)))) err(1, "calloc"); - + if ((comparetime = time(NULL)) == -1) + err(1, "time"); /* 1 day old is old news */ - comparetime = time(NULL) - 86400; + comparetime -= 86400; fputs("<!DOCTYPE HTML>\n" "<html>\n" diff --git a/sfeed_plain.c b/sfeed_plain.c @@ -40,8 +40,10 @@ main(int argc, char *argv[]) char *name; int i; + if ((comparetime = time(NULL)) == -1) + err(1, "time"); /* 1 day is old news */ - comparetime = time(NULL) - (3600 * 24); + comparetime -= 86400; if (argc == 1) { printfeed(stdin, "");