make daemonizing the last step in command processing
This commit is contained in:
		
							
								
								
									
										19
									
								
								adhocify.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								adhocify.c
									
									
									
									
									
								
							@@ -555,15 +555,7 @@ void process_options()
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		queue_watches_from_stdin();
 | 
							queue_watches_from_stdin();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if(daemonize)
 | 
					
 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		if(daemon(0,0) == -1)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			perror("daemon");
 | 
					 | 
				
			||||||
			exit(EXIT_FAILURE);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if(watchlist_head == NULL)
 | 
						if(watchlist_head == NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		watchqueue_add_path(get_cwd());
 | 
							watchqueue_add_path(get_cwd());
 | 
				
			||||||
@@ -590,6 +582,15 @@ void process_options()
 | 
				
			|||||||
		char *path_prog = xrealpath(prog, NULL);
 | 
							char *path_prog = xrealpath(prog, NULL);
 | 
				
			||||||
		check_forkbomb(path_logfile, path_prog);
 | 
							check_forkbomb(path_logfile, path_prog);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if(daemonize)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if(daemon(0,0) == -1)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								perror("daemon");
 | 
				
			||||||
 | 
								exit(EXIT_FAILURE);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void start_monitoring(int ifd)
 | 
					void start_monitoring(int ifd)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user