X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/eb525fcd474c7c30e98e0764698a6fac33eb10ce..1a48886fd8916757e21c099304d57a20a15786b6:/disobedience/disobedience.c diff --git a/disobedience/disobedience.c b/disobedience/disobedience.c index 9ee7b33..c37d0bc 100644 --- a/disobedience/disobedience.c +++ b/disobedience/disobedience.c @@ -22,6 +22,7 @@ #include #include +#include /* Apologies for the numerous de-consting casts, but GLib et al do not seem to * have heard of const. */ @@ -319,9 +320,11 @@ int main(int argc, char **argv) { int n; disorder_eclient *logclient; - mem_init(1); + mem_init(); + /* garbage-collect PCRE's memory */ + pcre_malloc = xmalloc; + pcre_free = xfree; if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale"); - /* Causes GTK+ to 0-fill lots of things, which helps the garbage collector. */ gtk_init(&argc, &argv); gtk_rc_parse_string(style); while((n = getopt_long(argc, argv, "hVc:dtH", options, 0)) >= 0) { @@ -335,13 +338,15 @@ int main(int argc, char **argv) { default: fatal(0, "invalid option"); } } + signal(SIGPIPE, SIG_IGN); /* create the event loop */ D(("create main loop")); mainloop = g_main_loop_new(0, 0); if(config_read()) fatal(0, "cannot read configuration"); /* create the clients */ - client = gtkclient(); - logclient = gtkclient(); + if(!(client = gtkclient()) + || !(logclient = gtkclient())) + return 1; /* already reported an error */ disorder_eclient_log(logclient, &gdisorder_log_callbacks, 0); /* periodic operations (e.g. expiring the cache) */ g_timeout_add(600000/*milliseconds*/, periodic, 0);