diff --git a/src/warden-client/lib/WardenClientConf.pm b/src/warden-client/lib/WardenClientConf.pm index c185aea65b4a0d9cb999a76a32d0ed614101d8dd..7720f6bb2f14bdd1e990e7144e033a33dd90d4cc 100755 --- a/src/warden-client/lib/WardenClientConf.pm +++ b/src/warden-client/lib/WardenClientConf.pm @@ -26,15 +26,11 @@ sub loadConf our $SSL_CA_FILE = undef; our $MAX_RCV_EVENTS_LIMIT = undef; - # read config file - if ( ! open( TMP, $conf_file) ) { - die("Can't read config file '$conf_file': $!\n"); - } - close TMP; - # load set variables by user - if ( !do $conf_file ) { - die("Errors in config file '$conf_file': $@"); + unless (do $conf_file) { + die("Errors in config file '$conf_file': $@") if $@; + die("Can't read config file '$conf_file': $!") unless defined $_; + # if $_ defined, it's retvalue of last statement of conf, for which we don't care } return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE, $MAX_RCV_EVENTS_LIMIT); diff --git a/src/warden-server/lib/Warden.pm b/src/warden-server/lib/Warden.pm index 0fcc219bc0f83835b4ead81378b26d837e8ecf59..742c15e74aa5bd58aebfd9f69c7a9c472f683a88 100755 --- a/src/warden-server/lib/Warden.pm +++ b/src/warden-server/lib/Warden.pm @@ -36,15 +36,11 @@ our $DB_HOST = undef; our $MAX_EVENTS_LIMIT = undef; our %VALID_STRINGS = undef; -# read config file -if (!open( TMP, $conf_file)) { - errMsg("Can't read config file '$conf_file': $!\n"); -} -close TMP; - # load set variables by user -if (!do $conf_file) { - errMsg("Errors in config file '$conf_file': $@"); +unless (do $conf_file) { + errMsg("Errors in config file '$conf_file': $@") if $@; + errMsg("Can't read config file '$conf_file': $!") unless defined $_; + # if $_ defined, it's retvalue of last statement of conf, for which we don't care } diff --git a/src/warden-server/lib/WardenConf.pm b/src/warden-server/lib/WardenConf.pm index 1d1ad54c2f656c2cef3e3122ac78a33ad91daf94..db32d5a3f176a9d124ff91b12f2da29bb566a044 100755 --- a/src/warden-server/lib/WardenConf.pm +++ b/src/warden-server/lib/WardenConf.pm @@ -25,15 +25,11 @@ sub loadConf our $SSL_CERT_FILE = undef; our $SSL_CA_FILE = undef; - # read config file - if ( ! open( TMP, $conf_file) ) { - die "Can't read config file '$conf_file': $!\n"; - } - close TMP; - # load set variables by user - if ( !do $conf_file ) { - die("Errors in config file '$conf_file': $@"); + unless (do $conf_file) { + die("Errors in config file '$conf_file': $@") if $@; + die("Can't read config file '$conf_file': $!") unless defined $_; + # if $_ defined, it's retvalue of last statement of conf, for which we don't care } return ($URI, $SSL_KEY_FILE, $SSL_CERT_FILE, $SSL_CA_FILE);