[asterisk-commits] rmudgett: branch 10 r371890 - in /branches/10: ./ main/channel.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 29 14:40:24 CDT 2012
Author: rmudgett
Date: Wed Aug 29 14:40:20 2012
New Revision: 371890
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371890
Log:
Initialize file descriptors for dummy channels to -1.
Dummy channels usually aren't read from, but functions like SHELL and CURL
use autoservice on the channel.
(closes issue ASTERISK-20283)
Reported by: Gareth Palmer
Patches:
svn-371580.patch (license #5169) patch uploaded by Gareth Palmer (modified)
........
Merged revisions 371888 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/main/channel.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/channel.c?view=diff&rev=371890&r1=371889&r2=371890
==============================================================================
--- branches/10/main/channel.c (original)
+++ branches/10/main/channel.c Wed Aug 29 14:40:20 2012
@@ -1400,6 +1400,7 @@
{
struct ast_channel *tmp;
struct varshead *headp;
+ int x;
#if defined(REF_DEBUG)
tmp = __ao2_alloc_debug(sizeof(*tmp), ast_dummy_channel_destructor, "dummy channel",
@@ -1418,6 +1419,22 @@
if ((ast_string_field_init(tmp, 128))) {
return ast_channel_unref(tmp);
}
+
+ /*
+ * Init file descriptors to unopened state just in case
+ * autoservice is called on the channel or something tries to
+ * read a frame from it.
+ */
+ tmp->timingfd = -1;
+ for (x = 0; x < ARRAY_LEN(tmp->alertpipe); ++x) {
+ tmp->alertpipe[x] = -1;
+ }
+ for (x = 0; x < ARRAY_LEN(tmp->fds); ++x) {
+ tmp->fds[x] = -1;
+ }
+#ifdef HAVE_EPOLL
+ tmp->epfd = -1;
+#endif
headp = &tmp->varshead;
AST_LIST_HEAD_INIT_NOLOCK(headp);
More information about the asterisk-commits
mailing list