aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2026-03-10 21:26:55 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2026-03-10 22:19:00 +0100
commit0d8e5fbc31e1082063bfb5155c35b7869721152b (patch)
treed13d25a2ef93af13deaaf285dbcd26bbb5a5a1c6 /ui-shared.c
parentui-log: allow link following to be disabled per-repo (diff)
downloadcgit-master.tar.xz
cgit-master.zip
cgit: override die routine globallyHEADmaster
We don't get any return value from compile_grep_patterns calling compile_regexp_failed, causing the default die routine to print to stderr and then for cgit to exit ungracefully. Instead override the default die routine to show a normal error page. Perhaps compile_grep_patterns ought to change upstream to return an error. But this commit here will handle future issues as well, so perhaps not a bad idea to do anyway. Link: https://lists.zx2c4.com/pipermail/cgit/2026-March/004982.html Link: https://lists.zx2c4.com/pipermail/cgit/2026-March/004983.html Reported-by: Adrian C. <anrxc@sysphere.org> Reported-by: Aiden Woodruff <aiden@aidenw.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 219b830..df52a9b 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -889,13 +889,18 @@ void cgit_print_docend(void)
void cgit_print_error_page(int code, const char *msg, const char *fmt, ...)
{
va_list ap;
+ va_start(ap, fmt);
+ cgit_vprint_error_page(code, msg, fmt, ap);
+ va_end(ap);
+}
+
+void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list ap)
+{
ctx.page.expires = ctx.cfg.cache_dynamic_ttl;
ctx.page.status = code;
ctx.page.statusmsg = msg;
cgit_print_layout_start();
- va_start(ap, fmt);
cgit_vprint_error(fmt, ap);
- va_end(ap);
cgit_print_layout_end();
}