mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	res_agi.c: Ensure SIGCHLD handler functions are properly balanced.
Calls to `ast_replace_sigchld()` and `ast_unreplace_sigchld()` must be
balanced to ensure that we can capture the exit status of child
processes when we need to. This extends to functions that call
`ast_replace_sigchld()` and `ast_unreplace_sigchld()` such as
`ast_safe_fork()` and `ast_safe_fork_cleanup()`.
The primary change here is ensuring that we do not call
`ast_safe_fork_cleanup()` in `res_agi.c` if we have not previously
called `ast_safe_fork()`.
Additionally we reinforce some of the documentation and add an
assertion to, ideally, catch this sooner were this to happen again.
Fixes #922
(cherry picked from commit c80ce750bb)
			
			
This commit is contained in:
		
				
					committed by
					
						 Asterisk Development Team
						Asterisk Development Team
					
				
			
			
				
	
			
			
			
						parent
						
							423f0bdc99
						
					
				
				
					commit
					7973b7474a
				
			| @@ -1537,6 +1537,10 @@ int ast_safe_fork(int stop_reaper); | ||||
|  | ||||
| /*! | ||||
|  * \brief Common routine to cleanup after fork'ed process is complete (if reaping was stopped) | ||||
|  * | ||||
|  * \note This must <b>not</b> be called unless ast_safe_fork(1) has been called | ||||
|  * previously. | ||||
|  * | ||||
|  * \since 1.6.1 | ||||
|  */ | ||||
| void ast_safe_fork_cleanup(void); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user