aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-02 21:36:39 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-02 21:36:39 +0000
commite08cb0ffa6dbd44c975ad5186f326ba2ee94b718 (patch)
tree1ff96db0aa1cf867ac85b9adfc65844e982bbde7 /channels/chan_agent.c
parent4015a6816f3f78a0f4ef60529029d4a7dcbb1c9a (diff)
Have the DEADLOCK_AVOIDANCE macro warn when an unlock fails, to help catch potentially large software bugs.
(closes issue #17407) Reported by: pdf Patches: 20100527__issue17407.diff.txt uploaded by tilghman (license 14) Review: https://reviewboard.asterisk.org/r/751/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@273793 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 7bbee404a..bd1988118 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -707,7 +707,12 @@ static int agent_indicate(struct ast_channel *ast, int condition, const void *da
ast_mutex_lock(&p->lock);
if (p->chan && !ast_check_hangup(p->chan)) {
while (ast_channel_trylock(p->chan)) {
- ast_channel_unlock(ast);
+ int res;
+ if ((res = ast_channel_unlock(ast))) {
+ ast_log(LOG_ERROR, "chan_agent bug! Channel was not locked upon entry to agent_indicate: %s\n", strerror(res));
+ ast_mutex_unlock(&p->lock);
+ return -1;
+ }
usleep(1);
ast_channel_lock(ast);
}