From 0bfc35c88e75a7eb47c38f7a31b6cf7f84130ea5 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 29 May 2019 21:44:25 +0100 Subject: Read debug setting from configuration file immediately before doing debug file rotation to avoid writing to previous debug file. --- TODO | 4 +++- blabouncer.c | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index e416113..65f042a 100644 --- a/TODO +++ b/TODO @@ -13,4 +13,6 @@ Implement daemon (background) mode. Implement BLABOUNCER EXIT command. -Some text gets written to previous debug.txt upon startup (getconfstr() output). +Implement connect commands (plus maybe a specific NickServ IDENTIFY command). + +Include NOTICEs in the replay log. diff --git a/blabouncer.c b/blabouncer.c index 851df7a..e0c9b21 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -2558,13 +2558,6 @@ int main(int argc, char *argv[]) { } } - // Is debugging enabled? - debug = getconfint("debug", settings.conffile); - if (!snprintf(debugpath, PATH_MAX, "%s/debug.txt", settings.basedir)) { - fprintf(stderr, "Error while preparing debug path location!\n"); - exit(1); - } - // Make sure the base directory exists struct stat st = {0}; if (stat(settings.basedir, &st) == -1) { @@ -2582,6 +2575,13 @@ int main(int argc, char *argv[]) { // Is replay logging enabled? settings.replaylogging = getconfint("replaylogging", settings.conffile); + // Is debugging enabled? + debug = getconfint("debug", settings.conffile); + if (!snprintf(debugpath, PATH_MAX, "%s/debug.txt", settings.basedir)) { + fprintf(stderr, "Error while preparing debug path location!\n"); + exit(1); + } + // Prepare the debug file // (Keep DEBUGFILESKEEP number of debug files around for past debugging) if (DEBUGFILESKEEP > 0) { -- cgit v1.2.3