Use reload_config() in main.

Michael
This commit is contained in:
Michael Adam 2009-12-07 01:11:17 +01:00
parent 0d0de2fcc5
commit 947d85cefc

View File

@ -48,6 +48,7 @@
* Global Structures
*/
struct config_s config;
struct config_s config_defaults;
unsigned int received_sighup = FALSE; /* boolean */
unsigned int processed_config_file = FALSE; /* boolean */
@ -333,37 +334,17 @@ main (int argc, char **argv)
*/
umask (0177);
initialize_config_defaults (&config);
process_cmdline (argc, argv, &config);
initialize_config_defaults (&config_defaults);
process_cmdline (argc, argv, &config_defaults);
log_message (LOG_INFO, "Initializing " PACKAGE " ...");
ret = load_config_file(config.config_file, &config);
ret = reload_config(config_defaults.config_file, &config,
&config_defaults);
if (ret != 0) {
exit (EX_SOFTWARE);
}
/* Set the default values if they were not set in the config
* file. */
if (config.port == 0) {
fprintf (stderr, "%s: You MUST set a Port in the "
"config file.\n", argv[0]);
exit (EX_SOFTWARE);
}
if (!config.user) {
log_message (LOG_WARNING, "You SHOULD set a UserName in the "
"config file. Using current user instead.");
}
if (config.idletimeout == 0) {
log_message (LOG_WARNING, "Invalid idle time setting. "
"Only values greater than zero are allowed. "
"Therefore setting idle timeout to %u seconds.",
MAX_IDLE_TIME);
config.idletimeout = MAX_IDLE_TIME;
}
ret = setup_logging ();
if (ret != 0) {
exit (EX_SOFTWARE);