getcomparetime: clarify the error message a bit on an invalid value - sfeed - RSS and Atom parser
HTML git clone git://git.codemadness.org/sfeed
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 30fbd4578cfec6d12549bd9f99a2b9677b5c668f
DIR parent ad02e2b4169d0a7b2ce4d209dbe4c2deca4bd7d8
HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 21 Feb 2026 12:31:58 +0100
getcomparetime: clarify the error message a bit on an invalid value
This is rare, but happens if $SFEED_NEW_AGE is empty or set to an invalid value
(like "zzz").
Even more rare would be if time(NULL) returns (time_t)-1.
Diffstat:
M sfeed_curses.c | 2 +-
M sfeed_frames.c | 2 +-
M sfeed_gopher.c | 2 +-
M sfeed_html.c | 2 +-
M sfeed_plain.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
---
DIR diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1294,7 +1294,7 @@ feeds_load(struct feed *feeds, size_t nfeeds)
errno = 0;
if ((comparetime = getcomparetime()) == (time_t)-1)
- die("getcomparetime");
+ die("getcomparetime: could not get the current time or $SFEED_NEW_AGE is invalid");
for (i = 0; i < nfeeds; i++) {
f = &feeds[i];
DIR diff --git a/sfeed_frames.c b/sfeed_frames.c
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
err(1, "calloc");
if ((comparetime = getcomparetime()) == (time_t)-1)
- errx(1, "getcomparetime");
+ errx(1, "getcomparetime: could not get the current time or $SFEED_NEW_AGE is invalid");
/* write main index page */
if (!(fpindex = fopen("index.html", "wb")))
DIR diff --git a/sfeed_gopher.c b/sfeed_gopher.c
@@ -146,7 +146,7 @@ main(int argc, char *argv[])
}
if ((comparetime = getcomparetime()) == (time_t)-1)
- errx(1, "getcomparetime");
+ errx(1, "getcomparetime: could not get the current time or $SFEED_NEW_AGE is invalid");
if ((p = getenv("SFEED_GOPHER_HOST")))
host = p;
DIR diff --git a/sfeed_html.c b/sfeed_html.c
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
if (!(feeds = calloc(argc <= 1 ? 1 : argc, sizeof(struct feed))))
err(1, "calloc");
if ((comparetime = getcomparetime()) == (time_t)-1)
- errx(1, "getcomparetime");
+ errx(1, "getcomparetime: could not get the current time or $SFEED_NEW_AGE is invalid");
fputs("<!DOCTYPE HTML>\n"
"<html>\n"
DIR diff --git a/sfeed_plain.c b/sfeed_plain.c
@@ -62,7 +62,7 @@ main(int argc, char *argv[])
err(1, "pledge");
if ((comparetime = getcomparetime()) == (time_t)-1)
- errx(1, "getcomparetime");
+ errx(1, "getcomparetime: could not get the current time or $SFEED_NEW_AGE is invalid");
if (argc <= 1) {
printfeed(stdin, "");