]> 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:00 +0000 (20:01 +0000)
commit06d8aac6fdb0b6b2bea8b9f3134ba23ae1aa7946
treeb79e7ca4c92c46510ba16487c55df56379e6ffe0
parent2e3879a609e2a6f33863db3914b706dd1517e755
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 750333ae033fe813a359064758864be265cb3aea)
apps/app_voicemail.c
include/asterisk/app.h
main/asterisk.c
res/res_agi.c