From aabbe6a3bb00e2e818ce0f8fc1b36b562b40fb7c Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 22 May 2019 14:01:22 +0200 Subject: [PATCH] MINOR: WURFL: do not emit warnings when not configured At the moment the WURFL module emits 3 lines of warnings upon startup when it is not referenced in the configuration file, which is quite confusing. Let's make sure to keep it silent when not configured, as detected by the absence of the wurfl-data-file statement. --- src/wurfl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wurfl.c b/src/wurfl.c index 5d720af695..27e673d021 100644 --- a/src/wurfl.c +++ b/src/wurfl.c @@ -260,6 +260,11 @@ static int ha_wurfl_init(void) int wurfl_result_code = WURFL_OK; int len; + // wurfl-data-file not configured, WURFL is not used so don't try to + // configure it. + if (global_wurfl.data_file == NULL) + return 0; + ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION); // creating WURFL handler global_wurfl.handle = wurfl_create(); @@ -272,11 +277,6 @@ static int ha_wurfl_init(void) ha_notice("WURFL: Engine handler created - API version %s\n", wurfl_get_api_version() ); // set wurfl data file - if (global_wurfl.data_file == NULL) { - ha_warning("WURFL: missing wurfl-data-file parameter in global configuration\n"); - return ERR_WARN; - } - if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) { ha_warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); return ERR_WARN;