From dac02a3d9c7d46d47ef8283d88399d020fa285b7 Mon Sep 17 00:00:00 2001 From: Francesco Salvestrini Date: Sat, 27 Sep 2008 01:35:53 +0200 Subject: [PATCH] Fixed configuration related code --- src/client/distribute.cxx | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/client/distribute.cxx b/src/client/distribute.cxx index 247dfdd..70e540f 100644 --- a/src/client/distribute.cxx +++ b/src/client/distribute.cxx @@ -143,10 +143,8 @@ int main(int argc, char * argv[]) } } - TR_DBG("Initial values:\n"); - TR_DBG(" Time out: '%d'\n", time_out); - TR_DBG(" Job: '%s'\n", job.c_str()); - TR_DBG(" Configuration file: '%s'\n", conffile.c_str()); + // Options related checks + BUG_ON(time_out < 0); // Build configuration file path if (conffile.size() == 0) { @@ -166,6 +164,9 @@ int main(int argc, char * argv[]) BUG_ON(conffile.size() == 0); + TR_DBG("Initial (configuration file) values:\n"); + TR_DBG(" Time out: '%d'\n", time_out); + // Read configuration file (if available) try { TR_DBG("Reading configuration file from '%s'\n", @@ -179,11 +180,18 @@ int main(int argc, char * argv[]) int conf_timeout; if (config.get(conf_timeout, "time-out")) { - TR_DBG("Found 'timeout' key, value '%d'\n", + TR_DBG("Found 'max-mem' key, value '%d'\n", conf_timeout); + // Check gathered configuration + if (time_out < 0) { + TR_ERR("Wrong time-out value in " + "configuration file"); + return 1; + } + if (!time_out_set) { - TR_DBG("Updating 'timeout' key\n"); + TR_DBG("Updating 'time-out' key\n"); // Configuration value not specified // in command line ... @@ -196,11 +204,11 @@ int main(int argc, char * argv[]) BUG(); } - // Check gathered configuration - if (time_out < 0) { - hint("Wrong time-out value"); - return 1; - } + // Options related checks + BUG_ON(time_out < 0); + + TR_DBG("Final (configuration file) values:\n"); + TR_DBG(" Time out: '%d'\n", time_out); // Dump (acquired and derived) infos TR_DBG("Final values:\n"); -- 2.11.4.GIT