From: Brian West Date: Mon, 17 Jun 2019 16:02:51 +0000 (-0500) Subject: FS-10634: [core] Fix switch_channel_wait_for_app_flag from previous commit X-Git-Tag: v1.10.0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dab7d83e94ed647b4b301ba3b30ca5c1ccc1ebc7;p=thirdparty%2Ffreeswitch.git FS-10634: [core] Fix switch_channel_wait_for_app_flag from previous commit --- diff --git a/src/switch_channel.c b/src/switch_channel.c index 934db1e047..c5c61d43ae 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1752,17 +1752,19 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_ uint32_t app_flag, const char *key, switch_bool_t pres, uint32_t to) { + int r = 0; + if (to) { to++; } for (;;) { if (pres) { - if (switch_channel_test_app_flag_key(key, channel, app_flag)) { + if ((r = switch_channel_test_app_flag_key(key, channel, app_flag))) { break; } } else { - if (!switch_channel_test_app_flag_key(key, channel, app_flag)) { + if (!(r = switch_channel_test_app_flag_key(key, channel, app_flag))) { break; } } @@ -1770,15 +1772,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_ switch_cond_next(); if (switch_channel_down(channel)) { - return SWITCH_STATUS_FALSE; + return r; } if (to && !--to) { - return SWITCH_STATUS_FALSE; + return r; } } - return SWITCH_STATUS_SUCCESS; + return r; }