commit 66c61872e8c278b8fb357d80c8bbb965afa38809
parent 48fc280aff79010f1244d532bf797605de0b7bb4
Author: Paco Esteban <paco@e1e0.net>
Date: Tue, 16 Jun 2020 19:36:20 +0200
check if header/footer exists
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ssnail.c b/ssnail.c
@@ -272,11 +272,13 @@ write_html(struct article *ap, char head_tpl[PATH_MAX], char foot_tpl[PATH_MAX])
|| strlen(ap->date) == 0)
goto out;
- load_from_file(&header, head_tpl);
+ if (load_from_file(&header, head_tpl) == 0)
+ return r;
header = str_rep(header, "$title$", ap->title);
header = str_rep(header, "$author$", ap->author);
header = str_rep(header, "$date$", ap->date);
- load_from_file(&footer, foot_tpl);
+ if (load_from_file(&footer, foot_tpl) == 0)
+ goto out;
footer = str_rep(footer, "$title$", ap->title);
if ((fout = fopen(ap->dst_path, "w")) == NULL)