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:
		
							parent
							
								
									a53f62a212
								
							
						
					
					
						commit
						46acc7f6b6
					
				
							
								
								
									
										10
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 rofl0r
						rofl0r