From 46acc7f6b6104323af629d5a6cb4c2c409f61c2c Mon Sep 17 00:00:00 2001 From: rofl0r Date: Tue, 27 Feb 2018 20:18:48 +0000 Subject: [PATCH] do not daemonize by default, change -d switch to -D having the program forking into background by default is a very unintuitive behaviour, and in case an error happens the process terminates "silently" (that is, it will only log the error to logfile). rather than reversing the meaning of the -d command line option, we replace it with -D so users will notice the change and can change their scripts, instead of getting a silently different behaviour. --- src/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 35ff704..e25d9a4 100644 --- a/src/main.c +++ b/src/main.c @@ -147,7 +147,7 @@ display_usage (void) printf ("Usage: %s [options]\n", PACKAGE); printf ("\n" "Options are:\n" - " -d Do not daemonize (run in foreground).\n" + " -D Daemonize (fork into background).\n" " -c FILE Use an alternate configuration file.\n" " -h Display this usage information.\n" " -l Display the license.\n" @@ -224,7 +224,7 @@ process_cmdline (int argc, char **argv, struct config_s *conf) { int opt; - while ((opt = getopt (argc, argv, "c:vldh")) != EOF) { + while ((opt = getopt (argc, argv, "c:vlDh")) != EOF) { switch (opt) { case 'v': display_version (); @@ -234,8 +234,8 @@ process_cmdline (int argc, char **argv, struct config_s *conf) display_license (); exit (EX_OK); - case 'd': - conf->godaemon = FALSE; + case 'D': + conf->godaemon = TRUE; break; case 'c': @@ -347,7 +347,7 @@ static void initialize_config_defaults (struct config_s *conf) fprintf (stderr, PACKAGE ": Could not allocate memory.\n"); exit (EX_SOFTWARE); } - conf->godaemon = TRUE; + conf->godaemon = FALSE; /* * Make sure the HTML error pages array is NULL to begin with. * (FIXME: Should have a better API for all this)