commit 38837afd9b84d7f5b6e39072928a1f8ff2733a39
parent e3df66af907f6f14b2bd9176285701fa94bac81a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sun,  4 Jan 2015 18:55:28 +0100
sfeed_frames: always error if fopen failed
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git 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("<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"../../style.css\" />"
 			      "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /></head>\n"
 			      "<body class=\"frame\"><div class=\"content\">"