Fix Config::activate to not check nonexistant options.

This commit is contained in:
Thulinma 2012-08-14 20:42:35 +02:00
parent 08f28d134a
commit 977a8617a2

View file

@ -248,13 +248,17 @@ bool Util::Config::getBool(std::string optname){
}
/// Activated the stored config. This will:
/// - Drop permissions to the stored "username".
/// - Daemonize the process if "daemonize" is true.
/// - Drop permissions to the stored "username", if any.
/// - Daemonize the process if "daemonize" exists and is true.
/// - Set is_active to true.
/// - Set up a signal handler to set is_active to false for the SIGINT, SIGHUP and SIGTERM signals.
void Util::Config::activate(){
if (vals.isMember("username")){
setUser(getString("username"));
if (getBool("daemonize")){Daemonize();}
}
if (vals.isMember("daemonize") && getBool("daemonize")){
Daemonize();
}
struct sigaction new_action;
new_action.sa_handler = signal_handler;
sigemptyset (&new_action.sa_mask);