From 43c435086fc16b4e86468dc8bafcd777ae0eace3 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 16 May 2015 15:56:43 +0200 Subject: sfeed_frames: show mkdir error string, shorter function name normalizepath() --- sfeed_frames.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sfeed_frames.c b/sfeed_frames.c index 0af29e0..0eff8d1 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -110,7 +110,7 @@ printcontent(const char *s, FILE *fp) /* normalize path names, transform to lower-case and replace non-alpha and * non-digit with '-' */ static size_t -normalizepathname(const char *path, char *buf, size_t bufsiz) +normalizepath(const char *path, char *buf, size_t bufsiz) { size_t i = 0, r = 0; @@ -158,8 +158,10 @@ main(int argc, char *argv[]) comparetime = time(NULL) - 86400; basepathlen = strlen(basepath); - if(basepathlen > 0) + if(basepathlen > 0) { mkdir(basepath, S_IRWXU); + xerr(1, "mkdir: %s", basepath); + } /* write main index page */ esnprintf(dirpath, sizeof(dirpath), "%s/index.html", basepath); if(!(fpindex = fopen(dirpath, "w+b"))) @@ -189,7 +191,7 @@ main(int argc, char *argv[]) /* first of feed section or new feed section (differ from previous). */ if(!totalfeeds || strcmp(fcur->name, feedname)) { /* make directory for feedname */ - if(!(namelen = normalizepathname(feedname, name, sizeof(name)))) + if(!(namelen = normalizepath(feedname, name, sizeof(name)))) continue; esnprintf(dirpath, sizeof(dirpath), "%s/%s", basepath, name); @@ -225,7 +227,7 @@ main(int argc, char *argv[]) totalfeeds++; } /* write content */ - if(!(namelen = normalizepathname(fields[FieldTitle], name, sizeof(name)))) + if(!(namelen = normalizepath(fields[FieldTitle], name, sizeof(name)))) continue; esnprintf(filepath, sizeof(filepath), "%s/%s.html", dirpath, name); esnprintf(relfilepath, sizeof(relfilepath), "%s/%s.html", reldirpath, name); -- cgit v1.2.3