mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +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
This commit is contained in:
committed by
asterisk-org-access-app[bot]
parent
d1bba7efc0
commit
e76f671810
@@ -15803,7 +15803,6 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
|
||||
if (!(vmu = find_user(&svm, testcontext, testmailbox)) &&
|
||||
!(vmu = find_or_create(testcontext, testmailbox))) {
|
||||
ast_test_status_update(test, "Cannot create vmu structure\n");
|
||||
ast_unreplace_sigchld();
|
||||
#ifdef IMAP_STORAGE
|
||||
chan = ast_channel_unref(chan);
|
||||
#endif
|
||||
@@ -15825,7 +15824,6 @@ AST_TEST_DEFINE(test_voicemail_msgcount)
|
||||
if ((syserr = ast_safe_system(syscmd))) {
|
||||
ast_test_status_update(test, "Unable to create test voicemail: %s\n",
|
||||
syserr > 0 ? strerror(syserr) : "unable to fork()");
|
||||
ast_unreplace_sigchld();
|
||||
#ifdef IMAP_STORAGE
|
||||
chan = ast_channel_unref(chan);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user