urls_read: exit early if opening the file with URLs fails - sfeed_curses - sfee… | |
git clone git://git.codemadness.org/sfeed_curses | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 768a524cd3bbfe7c225b08e539a6ba35f9464ecb | |
parent 827f4afdcecbb6cb53ee60d52d068ce5f94bbaac | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Wed, 14 Jul 2021 17:53:51 +0200 | |
urls_read: exit early if opening the file with URLs fails | |
This now requires the URLs file (SFEED_URL_FILE) to exist, but it will not | |
silently ignore the error if opening a file fails, for example with a | |
permission issue. | |
Diffstat: | |
M sfeed_curses.c | 4 +++- | |
1 file changed, 3 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/sfeed_curses.c b/sfeed_curses.c | |
@@ -2035,8 +2035,10 @@ urls_read(void) | |
urls_free(); | |
- if (!urlfile || !(fp = fopen(urlfile, "rb"))) | |
+ if (!urlfile) | |
return; | |
+ if (!(fp = fopen(urlfile, "rb"))) | |
+ die("fopen: %s", urlfile); | |
while ((n = getline(&line, &linesiz, fp)) > 0) { | |
if (line[n - 1] == '\n') |