summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-08-29 19:48:56 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-08-29 19:48:56 +0000
commit6e2d8c06ea740a1cd04faa2f8b7f8869fdb90466 (patch)
treeaddd8d9c59405fea206db34fc79c96abe7005934 /main
parent6c07c904aaae4a7d0ab7c74ade39b52365359178 (diff)
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 ........ Merged revisions 371890 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 371891 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/channel.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index bccba2e14..32ce57ec5 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1208,6 +1208,18 @@ struct ast_channel *ast_dummy_channel_alloc(void)
ast_pbx_hangup_handler_init(tmp);
AST_LIST_HEAD_INIT_NOLOCK(ast_channel_datastores(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.
+ */
+ ast_channel_timingfd_set(tmp, -1);
+ ast_channel_internal_alertpipe_clear(tmp);
+ ast_channel_internal_fd_clear_all(tmp);
+#ifdef HAVE_EPOLL
+ ast_channel_epfd(tmp) = -1;
+#endif
+
headp = ast_channel_varshead(tmp);
AST_LIST_HEAD_INIT_NOLOCK(headp);