[asterisk-commits] mjordan: branch 10 r362364 - in /branches/10: ./ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 17 16:11:30 CDT 2012
Author: mjordan
Date: Tue Apr 17 16:11:25 2012
New Revision: 362364
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=362364
Log:
Fix places in resources where a negative return value could impact execution
This patch addresses a number of modules in resources that did not handle the
negative return value from function calls adequately. This includes:
* res_agi.c: if the result of the read function is a negative number,
indicating some failure, the result would instead be treated as the number
of bytes read. This patch now treats negative results in the same manner
as an end of file condition, with the exception that it also logs the
error code indicated by the return.
* res_musiconhold.c: if spawn_mp3 fails to assign a file descriptor to srcfd,
and instead assigns a negative value, that file descriptor could later be
passed to functions that require a valid file descriptor. If spawn_mp3 fails,
we now immediately retry instead of continuing in the logic.
* res_rtp_asterisk.c: if no codec can be matched between two RTP instances
in a peer to peer bridge, we immediately return instead of attempting to
use the codec payload type as an index to determine the appropriate negotiated
codec.
(issue ASTERISK-19655)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/1863/
........
Merged revisions 362362 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/res/res_agi.c
branches/10/res/res_musiconhold.c
branches/10/res/res_rtp_asterisk.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_agi.c?view=diff&rev=362364&r1=362363&r2=362364
==============================================================================
--- branches/10/res/res_agi.c (original)
+++ branches/10/res/res_agi.c Tue Apr 17 16:11:25 2012
@@ -1297,9 +1297,9 @@
setup_env(chan, "async", fds[1], 0, 0, NULL);
/* read the environment */
res = read(fds[0], agi_buffer, AGI_BUF_SIZE);
- if (!res) {
- ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n",
- chan->name);
+ if (res <= 0) {
+ ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s: %s\n",
+ chan->name, res < 0 ? strerror(errno) : "EOF");
returnstatus = AGI_RESULT_FAILURE;
goto async_agi_abort;
}
@@ -1327,9 +1327,9 @@
* fd (the pipe), let's read the response.
*/
res = read(fds[0], agi_buffer, AGI_BUF_SIZE);
- if (!res) {
- ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s\n",
- chan->name);
+ if (res <= 0) {
+ ast_log(LOG_ERROR, "Failed to read from Async AGI pipe on channel %s: %s\n",
+ chan->name, res < 0 ? strerror(errno) : "EOF");
free_agi_cmd(cmd);
returnstatus = AGI_RESULT_FAILURE;
goto async_agi_done;
Modified: branches/10/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_musiconhold.c?view=diff&rev=362364&r1=362363&r2=362364
==============================================================================
--- branches/10/res/res_musiconhold.c (original)
+++ branches/10/res/res_musiconhold.c Tue Apr 17 16:11:25 2012
@@ -669,7 +669,7 @@
ast_log(LOG_WARNING, "Unable to spawn mp3player\n");
/* Try again later */
sleep(500);
- pthread_testcancel();
+ continue;
}
}
if (class->timer) {
Modified: branches/10/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/res/res_rtp_asterisk.c?view=diff&rev=362364&r1=362363&r2=362364
==============================================================================
--- branches/10/res/res_rtp_asterisk.c (original)
+++ branches/10/res/res_rtp_asterisk.c Tue Apr 17 16:11:25 2012
@@ -2046,6 +2046,11 @@
/* Otherwise adjust bridged payload to match */
bridged_payload = ast_rtp_codecs_payload_code(ast_rtp_instance_get_codecs(instance1), payload_type.asterisk_format, &payload_type.format, payload_type.rtp_code);
+ /* If no codec could be matched between instance and instance1, then somehow things were made incompatible while we were still bridged. Bail. */
+ if (bridged_payload < 0) {
+ return -1;
+ }
+
/* If the payload coming in is not one of the negotiated ones then send it to the core, this will cause formats to change and the bridge to break */
if (!(ast_rtp_instance_get_codecs(instance1)->payloads[bridged_payload].rtp_code) &&
!(ast_rtp_instance_get_codecs(instance1)->payloads[bridged_payload].asterisk_format)) {
More information about the asterisk-commits
mailing list