about summary refs log tree commit diff stats
path: root/ui-repolist.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/ui-repolist.c b/ui-repolist.c index 3aedde5..7c7aa9b 100644 --- a/ui-repolist.c +++ b/ui-repolist.c
@@ -18,19 +18,20 @@
18 18
19time_t read_agefile(char *path) 19time_t read_agefile(char *path)
20{ 20{
21 FILE *f; 21 time_t result;
22 static char buf[64], buf2[64]; 22 size_t size;
23 char *buf;
24 static char buf2[64];
23 25
24 if (!(f = fopen(path, "r"))) 26 if (readfile(path, &buf, &size))
25 return -1; 27 return -1;
26 buf[0] = 0; 28
27 if (fgets(buf, sizeof(buf), f) == NULL)
28 return -1;
29 fclose(f);
30 if (parse_date(buf, buf2, sizeof(buf2))) 29 if (parse_date(buf, buf2, sizeof(buf2)))
31 return strtoul(buf2, NULL, 10); 30 result = strtoul(buf2, NULL, 10);
32 else 31 else
33 return 0; 32 result = 0;
33 free(buf);
34 return result;
34} 35}
35 36
36static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) 37static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
@@ -274,6 +275,11 @@ void cgit_print_repolist()
274 275
275void cgit_print_site_readme() 276void cgit_print_site_readme()
276{ 277{
277 if (ctx.cfg.root_readme) 278 if (!ctx.cfg.root_readme)
278 html_include(ctx.cfg.root_readme); 279 return;
280 if (ctx.cfg.about_filter)
281 cgit_open_filter(ctx.cfg.about_filter);
282 html_include(ctx.cfg.root_readme);
283 if (ctx.cfg.about_filter)
284 cgit_close_filter(ctx.cfg.about_filter);
279} 285}