From 1e4f7e63249b0300cac27e725e14a0134260a387 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Tue, 17 Feb 2015 09:44:33 +0100 Subject: [PATCH] Refuse to load broken configs on irssi start By temporarily raising the fatal log level to critical during irssi start-up, we make it fail when the config file is broken. This is then re-set so that /reload of a broken config file will not crash irssi and just report the errors and gracefully continue instead. --- src/fe-text/irssi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index 77033d7a..6d5b9b13 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -310,6 +310,7 @@ int main(int argc, char **argv) { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL }, { NULL } }; + int loglev; #ifdef USE_GC g_mem_set_vtable(&gc_mem_table); @@ -352,6 +353,7 @@ int main(int argc, char **argv) you have to call setlocale(LC_ALL, "") */ setlocale(LC_ALL, ""); + loglev = g_log_set_always_fatal(G_LOG_FATAL_MASK | G_LOG_LEVEL_CRITICAL); textui_init(); if (!dummy && !term_init()) { @@ -360,6 +362,7 @@ int main(int argc, char **argv) return 1; } + g_log_set_always_fatal(loglev); textui_finish_init(); main_loop = g_main_new(TRUE);