From 6bb38b0df57c58c2f8088d990a28f2b2a8a87196 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Thu, 30 Jul 2015 16:09:54 +0200 Subject: check for time() failure --- sfeed_frames.c | 4 +++- sfeed_html.c | 5 +++-- sfeed_plain.c | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sfeed_frames.c b/sfeed_frames.c index c73a91d..b34a26d 100644 --- 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 index 707f341..efd39db 100644 --- 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("\n" "\n" diff --git a/sfeed_plain.c b/sfeed_plain.c index f3ffcf7..4942d92 100644 --- 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, ""); -- cgit v1.2.3