summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-01-15 14:17:13 +0000
committerrofl0r <rofl0r@users.noreply.github.com>2020-01-15 14:17:13 +0000
commit25205fd1f328df935aa416c9478d6a0bcf1a7d96 (patch)
tree02aa0fce48a7b73e7972671e249b4bbbae39f8e1 /src
parentcd005a94cec38e73ca796f1d142c193f48aaa27f (diff)
move initialize_config_defaults to conf.c
Diffstat (limited to 'src')
-rw-r--r--src/conf.c22
-rw-r--r--src/conf.h2
-rw-r--r--src/main.c22
3 files changed, 24 insertions, 22 deletions
diff --git a/src/conf.c b/src/conf.c
index eded11a..16a026d 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -442,6 +442,28 @@ done:
return ret;
}
+void initialize_config_defaults (struct config_s *conf)
+{
+ memset (conf, 0, sizeof(*conf));
+
+ conf->config_file = safestrdup (SYSCONFDIR "/tinyproxy.conf");
+ if (!conf->config_file) {
+ fprintf (stderr, PACKAGE ": Could not allocate memory.\n");
+ exit (EX_SOFTWARE);
+ }
+ conf->godaemon = TRUE;
+ /*
+ * Make sure the HTML error pages array is NULL to begin with.
+ * (FIXME: Should have a better API for all this)
+ */
+ conf->errorpages = NULL;
+ conf->stathost = safestrdup (TINYPROXY_STATHOST);
+ conf->idletimeout = MAX_IDLE_TIME;
+ conf->logf_name = NULL;
+ conf->pidpath = NULL;
+ conf->maxclients = 100;
+}
+
static void initialize_with_defaults (struct config_s *conf,
struct config_s *defaults)
{
diff --git a/src/conf.h b/src/conf.h
index 44f12d7..43f4f97 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -114,6 +114,8 @@ struct config_s {
vector_t add_headers;
};
+void initialize_config_defaults (struct config_s *conf);
+
extern int reload_config_file (const char *config_fname, struct config_s *conf,
struct config_s *defaults);
diff --git a/src/main.c b/src/main.c
index 06465b1..7f6d947 100644
--- a/src/main.c
+++ b/src/main.c
@@ -284,28 +284,6 @@ change_user (const char *program)
}
}
-static void initialize_config_defaults (struct config_s *conf)
-{
- memset (conf, 0, sizeof(*conf));
-
- conf->config_file = safestrdup (SYSCONFDIR "/tinyproxy.conf");
- if (!conf->config_file) {
- fprintf (stderr, PACKAGE ": Could not allocate memory.\n");
- exit (EX_SOFTWARE);
- }
- conf->godaemon = TRUE;
- /*
- * Make sure the HTML error pages array is NULL to begin with.
- * (FIXME: Should have a better API for all this)
- */
- conf->errorpages = NULL;
- conf->stathost = safestrdup (TINYPROXY_STATHOST);
- conf->idletimeout = MAX_IDLE_TIME;
- conf->logf_name = NULL;
- conf->pidpath = NULL;
- conf->maxclients = 100;
-}
-
/**
* convenience wrapper around reload_config_file
* that also re-initializes logging.