mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-15 22:38:08 +00:00
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)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@371888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1387,6 +1387,7 @@ struct ast_channel *ast_dummy_channel_alloc(void)
|
||||
{
|
||||
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",
|
||||
@@ -1406,6 +1407,22 @@ struct ast_channel *ast_dummy_channel_alloc(void)
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user