From 61d75021c8a1180d2b591e70c783bd2eb21188bd Mon Sep 17 00:00:00 2001 From: Erik K Date: Thu, 26 May 2022 16:31:27 +0000 Subject: mkdir parent directories when needed, also fixed bug in list(). --- rss.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'rss.c') diff --git a/rss.c b/rss.c index e0f22fe..b175441 100644 --- a/rss.c +++ b/rss.c @@ -1,4 +1,7 @@ +#include +#include #include +#include #include "config.h" #include "sm.h" @@ -61,7 +64,12 @@ rssexport(Document **doc, int ndoc) qsort(doc, ndoc, sizeof(*doc), (int (*)(const void *, const void *))creatcompar); - outf = xfopen(krssexport, "w"); + if (!mkparentdirs(krssexport)) + return; + if ((outf = fopen(krssexport, "w")) == NULL) { + fprintf(stderr, "%s: %s\n", krssexport, strerror(errno)); + return; + } for (j = 0; j < LEN(header); j++) xfputs(header[j], outf); for (i = 0; i < ndoc; i++) { -- cgit v1.2.3