summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-12-07 01:11:17 +0100
committerMichael Adam <obnox@samba.org>2009-12-07 01:11:35 +0100
commit947d85cefc608d925e2bc89af7e715f64e3467fe (patch)
treef8ef2683f66216a17bce172848219ef5719ef2f8 /src/main.c
parent0d0de2fcc5931ade625cd619321bb39f822ddce0 (diff)
downloadtinyproxy-947d85cefc608d925e2bc89af7e715f64e3467fe.tar.gz
tinyproxy-947d85cefc608d925e2bc89af7e715f64e3467fe.zip
Use reload_config() in main.
Michael
Diffstat (limited to '')
-rw-r--r--src/main.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/main.c b/src/main.c
index cb6c84b..8947443 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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);