diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-04 18:55:28 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-01-04 18:55:28 +0100 |
commit | 38837afd9b84d7f5b6e39072928a1f8ff2733a39 (patch) | |
tree | f5b3c62d3b375854745f260e463afcd5c9a79ebe | |
parent | e3df66af907f6f14b2bd9176285701fa94bac81a (diff) |
sfeed_frames: always error if fopen failed
-rw-r--r-- | sfeed_frames.c | 6 |
1 files 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("<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\">" |