summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-01-15 15:26:40 +0000
committerrofl0r <rofl0r@users.noreply.github.com>2020-01-15 15:26:40 +0000
commit180c0664aa2af528745f997df0fbeadb2c87bcff (patch)
tree41270eacc04380ceea52f114db887f584dcd3d96
parenteb2104e1ff07dcc7a05f81f8b87db9b6c77d8f5d (diff)
remove godaemon member from config structure
since this option can't be set via config file, it makes sense to factor it out and use it only where strictly needed, e.g. in startup code.
-rw-r--r--src/conf.c2
-rw-r--r--src/conf.h1
-rw-r--r--src/main.c6
3 files changed, 3 insertions, 6 deletions
diff --git a/src/conf.c b/src/conf.c
index 16a026d..c74216d 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -451,7 +451,6 @@ void initialize_config_defaults (struct config_s *conf)
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)
@@ -482,7 +481,6 @@ static void initialize_with_defaults (struct config_s *conf,
conf->stathost = safestrdup (defaults->stathost);
}
- conf->godaemon = defaults->godaemon;
conf->quit = defaults->quit;
if (defaults->user) {
diff --git a/src/conf.h b/src/conf.h
index 43f4f97..02fb699 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -43,7 +43,6 @@ struct config_s {
unsigned int syslog; /* boolean */
unsigned int port;
char *stathost;
- unsigned int godaemon; /* boolean */
unsigned int quit; /* boolean */
unsigned int maxclients;
char *user;
diff --git a/src/main.c b/src/main.c
index aac9a5b..8b2167d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -263,7 +263,7 @@ done:
int
main (int argc, char **argv)
{
- int opt;
+ int opt, daemonized = TRUE;
srand(time(NULL)); /* for hashmap seeds */
@@ -287,7 +287,7 @@ main (int argc, char **argv)
exit (EX_OK);
case 'd':
- (&config_defaults)->godaemon = FALSE;
+ daemonized = FALSE;
break;
case 'c':
@@ -330,7 +330,7 @@ main (int argc, char **argv)
anonymous_insert ("Content-Type");
}
- if (config.godaemon == TRUE) {
+ if (daemonized == TRUE) {
if (!config.syslog && config.logf_name == NULL)
fprintf(stderr, "WARNING: logging deactivated "
"(can't log to stdout when daemonized)\n");