From 38837afd9b84d7f5b6e39072928a1f8ff2733a39 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 4 Jan 2015 18:55:28 +0100 Subject: sfeed_frames: always error if fopen failed --- sfeed_frames.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sfeed_frames.c b/sfeed_frames.c index 63d0904..c72a504 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -147,7 +147,7 @@ main(int argc, char *argv[]) xerr(1, "fopen"); esnprintf(dirpath, sizeof(dirpath), "%s/menu.html", basepath); if(!(fpmenu = fopen(dirpath, "w+b"))) - xerr(1, "fopen: can't write menu.html"); + xerr(1, "fopen"); esnprintf(dirpath, sizeof(dirpath), "%s/items.html", basepath); if(!(fpitems = fopen(dirpath, "w+b"))) xerr(1, "fopen"); @@ -213,7 +213,9 @@ main(int argc, char *argv[]) esnprintf(relfilepath, sizeof(relfilepath), "%s/%s.html", reldirpath, name); /* file doesn't exist yet and has write access */ - if(access(filepath, F_OK) != 0 && (fpcontent = fopen(filepath, "w+b"))) { + if(access(filepath, F_OK) != 0) { + if(!(fpcontent = fopen(filepath, "w+b"))) + xerr(1, "fopen"); fputs("" "\n" "
" -- cgit v1.2.3