summaryrefslogtreecommitdiffstats
path: root/rss.c
diff options
context:
space:
mode:
authorErik K <erikk@previousplan.org>2022-05-26 16:31:27 +0000
committerErik K <erikk@previousplan.org>2022-05-26 16:31:27 +0000
commit61d75021c8a1180d2b591e70c783bd2eb21188bd (patch)
treee5401f7c66da4b41eb1bc7f01a8e98a38f8ceae8 /rss.c
parent9643e3cb444ee26088be4636ba2b753ac0166156 (diff)
mkdir parent directories when needed, also fixed bug in list().HEADmaster
Diffstat (limited to 'rss.c')
-rw-r--r--rss.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/rss.c b/rss.c
index e0f22fe..b175441 100644
--- a/rss.c
+++ b/rss.c
@@ -1,4 +1,7 @@
+#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#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++) {