Mercurial > dnsbl
diff src/dnsbl.cpp @ 89:946fc1bcfb2c stable-5-3
don't load null config pointer, keep the old one
author | carl |
---|---|
date | Sun, 07 Aug 2005 11:26:37 -0700 |
parents | c1280cd3e248 |
children | 962a1f8f1d9f |
line wrap: on
line diff
--- a/src/dnsbl.cpp Mon Aug 01 19:32:03 2005 -0700 +++ b/src/dnsbl.cpp Sun Aug 07 11:26:37 2005 -0700 @@ -1007,6 +1007,7 @@ } if (reload) { CONFIG *newc = new_conf(); + if (newc) { // replace the global config pointer pthread_mutex_lock(&config_mutex); CONFIG *old = config; @@ -1014,6 +1015,14 @@ pthread_mutex_unlock(&config_mutex); if (old) old_configs.insert(old); } + else { + // failed to load new config + my_syslog("failed to load new configuration"); + system("echo 'failed to load new dnsbl configuration from /etc/dnsbl' | mail -s 'error in /etc/dnsbl configuration' root"); + // update the load time on the current config to prevent complaining every 3 minutes + dc.load_time = time(NULL); + } + } // now look for old configs with zero ref counts for (configp_set::iterator i=old_configs.begin(); i!=old_configs.end(); ) { CONFIG *old = *i; @@ -1266,6 +1275,13 @@ } } + // load the initial config + config = new_conf(); + if (!config) { + my_syslog("failed to load initial configuration, quitting"); + exit(1); + } + // fork off the resolver listener process pid_t child = fork(); if (child < 0) { @@ -1336,9 +1352,6 @@ sleep(2); // allow child to get started } - // load the initial config - config = new_conf(); - // only create threads after the fork() in daemon pthread_t tid; if (pthread_create(&tid, 0, config_loader, 0))