Fixed crash in child of executable with grim_reaper active
This commit is contained in:
		
							parent
							
								
									9d7c6ddf29
								
							
						
					
					
						commit
						6419da5eba
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		|  | @ -65,6 +65,7 @@ bool Util::Procs::isRunning(pid_t pid){ | ||||||
| /// After that waits up to 5 seconds for children to exit, then sends SIGKILL to
 | /// After that waits up to 5 seconds for children to exit, then sends SIGKILL to
 | ||||||
| /// all remaining children. Waits one more second for cleanup to finish, then exits.
 | /// all remaining children. Waits one more second for cleanup to finish, then exits.
 | ||||||
| void Util::Procs::exit_handler() { | void Util::Procs::exit_handler() { | ||||||
|  |   if (!handler_set){return;} | ||||||
|   int waiting = 0; |   int waiting = 0; | ||||||
|   std::set<pid_t> listcopy; |   std::set<pid_t> listcopy; | ||||||
|   { |   { | ||||||
|  | @ -320,6 +321,7 @@ pid_t Util::Procs::StartPiped(const char * const * argv, int * fdin, int * fdout | ||||||
|   } |   } | ||||||
|   pid = fork(); |   pid = fork(); | ||||||
|   if (pid == 0) { //child
 |   if (pid == 0) { //child
 | ||||||
|  |     handler_set = false; | ||||||
|     //Close all sockets in the socketList
 |     //Close all sockets in the socketList
 | ||||||
|     for (std::set<int>::iterator it = Util::Procs::socketList.begin(); it != Util::Procs::socketList.end(); ++it){ |     for (std::set<int>::iterator it = Util::Procs::socketList.begin(); it != Util::Procs::socketList.end(); ++it){ | ||||||
|       close(*it); |       close(*it); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Thulinma
						Thulinma