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.
This commit is contained in:
rofl0r 2018-02-27 20:18:48 +00:00
parent a53f62a212
commit 46acc7f6b6

View File

@ -147,7 +147,7 @@ display_usage (void)
printf ("Usage: %s [options]\n", PACKAGE); printf ("Usage: %s [options]\n", PACKAGE);
printf ("\n" printf ("\n"
"Options are:\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" " -c FILE Use an alternate configuration file.\n"
" -h Display this usage information.\n" " -h Display this usage information.\n"
" -l Display the license.\n" " -l Display the license.\n"
@ -224,7 +224,7 @@ process_cmdline (int argc, char **argv, struct config_s *conf)
{ {
int opt; int opt;
while ((opt = getopt (argc, argv, "c:vldh")) != EOF) { while ((opt = getopt (argc, argv, "c:vlDh")) != EOF) {
switch (opt) { switch (opt) {
case 'v': case 'v':
display_version (); display_version ();
@ -234,8 +234,8 @@ process_cmdline (int argc, char **argv, struct config_s *conf)
display_license (); display_license ();
exit (EX_OK); exit (EX_OK);
case 'd': case 'D':
conf->godaemon = FALSE; conf->godaemon = TRUE;
break; break;
case 'c': case 'c':
@ -347,7 +347,7 @@ static void initialize_config_defaults (struct config_s *conf)
fprintf (stderr, PACKAGE ": Could not allocate memory.\n"); fprintf (stderr, PACKAGE ": Could not allocate memory.\n");
exit (EX_SOFTWARE); exit (EX_SOFTWARE);
} }
conf->godaemon = TRUE; conf->godaemon = FALSE;
/* /*
* Make sure the HTML error pages array is NULL to begin with. * Make sure the HTML error pages array is NULL to begin with.
* (FIXME: Should have a better API for all this) * (FIXME: Should have a better API for all this)