summaryrefslogtreecommitdiff
path: root/template.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2024-09-06 12:21:06 +0200
committerVincent Douillet <vincent@vdouillet.fr>2024-09-06 12:22:20 +0200
commitd7edafe299d44a0bec9d29e2b3a4ca853ffa1a80 (patch)
tree9f4de85662fbfd997bf5ee96671a2f776f2c53a6 /template.c
parent35a145fd161fb4d4f19aa9820b50438695b94414 (diff)
upload: add form
Diffstat (limited to 'template.c')
-rw-r--r--template.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/template.c b/template.c
index 4ac3e9f..a7b2922 100644
--- a/template.c
+++ b/template.c
@@ -117,22 +117,22 @@ page_template_new(const char *page)
page_template_free(tmpl);
return NULL;
}
- /* read page footer */
+ /* read page footer (optional) */
path_size = snprintf(template_path, sizeof(template_path), "%s/%s_%s",
TEMPLATE_DIR, page, "foot.html");
- if (path_size < 0 || path_size >= sizeof(template_path) ||
- read_file(template_path, &tmpl->page_footer, &file_size) < 0) {
+ if (path_size < 0 || path_size >= sizeof(template_path)) {
page_template_free(tmpl);
return NULL;
}
- /* read page item */
+ read_file(template_path, &tmpl->page_footer, &file_size);
+ /* read page item (optional) */
path_size = snprintf(template_path, sizeof(template_path), "%s/%s_%s",
TEMPLATE_DIR, page, "item.html");
- if (path_size < 0 || path_size >= sizeof(template_path) ||
- read_file(template_path, &tmpl->page_item, &file_size) < 0) {
+ if (path_size < 0 || path_size >= sizeof(template_path)) {
page_template_free(tmpl);
return NULL;
}
+ read_file(template_path, &tmpl->page_item, &file_size);
return tmpl;
}