]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes loop that could possibly never exit in the event of a channel never being able...
authorJeff Peeler <jpeeler@digium.com>
Thu, 21 Aug 2008 23:39:31 +0000 (23:39 +0000)
committerJeff Peeler <jpeeler@digium.com>
Thu, 21 Aug 2008 23:39:31 +0000 (23:39 +0000)
(closes issue #11017)

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

channels/chan_dahdi.c

index 125a971e1907556a445ab8bf96d1fe003c4b279d..e650ed291b9d6af682eb7a5faaf953db9a37ab85 100644 (file)
@@ -7342,12 +7342,14 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
                int chan_sig = conf->chan.sig;
                if (!here) {
                        if ((channel != CHAN_PSEUDO) && !pri) {
+                               int count = 0;
                                snprintf(fn, sizeof(fn), "%d", channel);
                                /* Open non-blocking */
                                tmp->subs[SUB_REAL].dfd = dahdi_open(fn);
-                               while (tmp->subs[SUB_REAL].dfd < 0 && reloading == 2) { /* the kernel may not call dahdi_release fast enough for the open flagbit to be cleared in time */
+                               while (tmp->subs[SUB_REAL].dfd < 0 && reloading == 2 && count < 1000) { /* the kernel may not call dahdi_release fast enough for the open flagbit to be cleared in time */
                                        usleep(1);
                                        tmp->subs[SUB_REAL].dfd = dahdi_open(fn);
+                                       count++;
                                }
                                /* Allocate a DAHDI structure */
                                if (tmp->subs[SUB_REAL].dfd < 0) {