From f2db4e459852fabb5745d2aed60b912e0d00cf8d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 20 Jul 2014 17:25:22 +0200 Subject: [PATCH] Always (attempt to) write config warnings and errors to the log file. This fixes issues like the IRCd mysteriously not being able to boot up without any error message, both on *NIX and Windows. --- src/ircd.c | 13 +++++-------- src/s_conf.c | 9 +++++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ircd.c b/src/ircd.c index 2c2de4cc0..46bf47a29 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -1450,17 +1450,14 @@ int InitwIRCD(int argc, char *argv[]) #endif if (!init_ssl()) { - ircd_log(LOG_ERROR, "WARNING: Failed to load SSL (no certificate?) -- continueing without SSL support..."); -#ifndef _WIN32 - fprintf(stderr, "WARNING: Failed to load SSL (no certificate or keys?) -- continueing without SSL support...\n"); -#endif + config_warn("Failed to load SSL (no certificate?) -- continueing without SSL support..."); if (ssl_used_in_config_but_unavail()) { - ircd_log(LOG_ERROR, "IRCd failed to start"); -#ifndef _WIN32 - fprintf(stderr, "IRCd failed to start\n"); + config_error("IRCd failed to start"); +#ifdef _WIN32 + win_error(); /* display error dialog box */ #endif - exit(9); /* ssl_used_in_config_but_unavail() takes care of error message. */ + exit(9); } } #endif diff --git a/src/s_conf.c b/src/s_conf.c index b0beec0ed..e9b32d5f9 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1212,8 +1212,7 @@ void config_error(char *format, ...) #else win_log("[error] %s", buffer); #endif - else - ircd_log(LOG_ERROR, "config error: %s", buffer); + ircd_log(LOG_ERROR, "config error: %s", buffer); sendto_realops("error: %s", buffer); /* We cannot live with this */ config_error_flag = 1; @@ -1277,6 +1276,7 @@ void config_status(char *format, ...) #else win_log("* %s", buffer); #endif + ircd_log(LOG_ERROR, "%s", buffer); sendto_realops("%s", buffer); } @@ -1297,6 +1297,7 @@ void config_warn(char *format, ...) #else win_log("[warning] %s", buffer); #endif + ircd_log(LOG_ERROR, "[warning] %s", buffer); sendto_realops("[warning] %s", buffer); } @@ -9722,14 +9723,14 @@ int ssl_used_in_config_but_unavail(void) for (listener = conf_listen; listener; listener = (ConfigItem_listen *)listener->next) if (listener->options & LISTENER_SSL) { - config_status("Listen block %s:%d is configured to use SSL, however SSL is unavailable due to an earlier error (certificate/key not loaded?)", listener->ip, listener->port); + config_error("Listen block %s:%d is configured to use SSL, however SSL is unavailable due to an earlier error (certificate/key not loaded?)", listener->ip, listener->port); errors++; } for (link = conf_link; link; link = (ConfigItem_link *)link->next) if (link->options & CONNECT_SSL) { - config_status("Link block %s is configured to use SSL, however SSL is unavailable due to an earlier error (certificate/key not loaded?)", link->servername); + config_error("Link block %s is configured to use SSL, however SSL is unavailable due to an earlier error (certificate/key not loaded?)", link->servername); errors++; }