]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_agi.c: Ensure SIGCHLD handler functions are properly balanced.
authorSean Bright <sean@seanbright.com>
Mon, 30 Sep 2024 15:48:56 +0000 (11:48 -0400)
committerSean Bright <sean@seanbright.com>
Tue, 1 Oct 2024 15:01:28 +0000 (15:01 +0000)
commitc80ce750bb170e7e56fd39b2e029629c69a34515
tree741d87cdd1429010158654058dfd7ff0fbe0bbbc
parentf415e313b4367e740d4c412b60fb9ec86ba00e04
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
apps/app_voicemail.c
include/asterisk/app.h
main/asterisk.c
res/res_agi.c