]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 371890 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Wed, 29 Aug 2012 20:25:06 +0000 (20:25 +0000)
committerAutomerge script <automerge@asterisk.org>
Wed, 29 Aug 2012 20:25:06 +0000 (20:25 +0000)
file:///srv/subversion/repos/asterisk/branches/10

................
  r371890 | rmudgett | 2012-08-29 14:40:20 -0500 (Wed, 29 Aug 2012) | 13 lines

  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
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10-digiumphones@371918 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel.c

index 11f135c676cedd5a45fb097fac707fb3394d245a..f09dbaa804d91328b2941f7a16399e29ae537f1c 100644 (file)
@@ -1400,6 +1400,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",
@@ -1419,6 +1420,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);