]> 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)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 14 Nov 2024 20:01:34 +0000 (20:01 +0000)
commit5152a05416da8afe85385843da7f811d92050cc5
tree81c2214a7f90fcaf3ceee3d1b93ef9fd142c7887
parent107c9e7c683692428994fadaef0b3016a96cd8e9
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 243f20a78d373d0154dd33488c91fd40a5b0cfa1)
apps/app_voicemail.c
include/asterisk/app.h
main/asterisk.c
res/res_agi.c