mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 16:20:37 +00:00
Don't segfault if chan_zap can't load
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3281 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5768,47 +5768,6 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
|||||||
for (x=0;x<3;x++)
|
for (x=0;x<3;x++)
|
||||||
tmp->subs[x].zfd = -1;
|
tmp->subs[x].zfd = -1;
|
||||||
tmp->channel = channel;
|
tmp->channel = channel;
|
||||||
/* nothing on the iflist */
|
|
||||||
if (!*wlist) {
|
|
||||||
*wlist = tmp;
|
|
||||||
tmp->prev = NULL;
|
|
||||||
tmp->next = NULL;
|
|
||||||
*wend = tmp;
|
|
||||||
} else {
|
|
||||||
/* at least one member on the iflist */
|
|
||||||
struct zt_pvt *working = *wlist;
|
|
||||||
|
|
||||||
/* check if we maybe have to put it on the begining */
|
|
||||||
if (working->channel > tmp->channel) {
|
|
||||||
tmp->next = *wlist;
|
|
||||||
tmp->prev = NULL;
|
|
||||||
*wlist = tmp;
|
|
||||||
} else {
|
|
||||||
/* go through all the members and put the member in the right place */
|
|
||||||
while (working) {
|
|
||||||
/* in the middle */
|
|
||||||
if (working->next) {
|
|
||||||
if (working->channel < tmp->channel && working->next->channel > tmp->channel) {
|
|
||||||
tmp->next = working->next;
|
|
||||||
tmp->prev = working;
|
|
||||||
working->next->prev = tmp;
|
|
||||||
working->next = tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* the last */
|
|
||||||
if (working->channel < tmp->channel) {
|
|
||||||
working->next = tmp;
|
|
||||||
tmp->next = NULL;
|
|
||||||
tmp->prev = working;
|
|
||||||
*wend = tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
working = working->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
@@ -6129,6 +6088,50 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
|
|||||||
}
|
}
|
||||||
if (si.alarms) tmp->inalarm = 1;
|
if (si.alarms) tmp->inalarm = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (tmp && !here) {
|
||||||
|
/* nothing on the iflist */
|
||||||
|
if (!*wlist) {
|
||||||
|
*wlist = tmp;
|
||||||
|
tmp->prev = NULL;
|
||||||
|
tmp->next = NULL;
|
||||||
|
*wend = tmp;
|
||||||
|
} else {
|
||||||
|
/* at least one member on the iflist */
|
||||||
|
struct zt_pvt *working = *wlist;
|
||||||
|
|
||||||
|
/* check if we maybe have to put it on the begining */
|
||||||
|
if (working->channel > tmp->channel) {
|
||||||
|
tmp->next = *wlist;
|
||||||
|
tmp->prev = NULL;
|
||||||
|
*wlist = tmp;
|
||||||
|
} else {
|
||||||
|
/* go through all the members and put the member in the right place */
|
||||||
|
while (working) {
|
||||||
|
/* in the middle */
|
||||||
|
if (working->next) {
|
||||||
|
if (working->channel < tmp->channel && working->next->channel > tmp->channel) {
|
||||||
|
tmp->next = working->next;
|
||||||
|
tmp->prev = working;
|
||||||
|
working->next->prev = tmp;
|
||||||
|
working->next = tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* the last */
|
||||||
|
if (working->channel < tmp->channel) {
|
||||||
|
working->next = tmp;
|
||||||
|
tmp->next = NULL;
|
||||||
|
tmp->prev = working;
|
||||||
|
*wend = tmp;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
working = working->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@@ -8262,7 +8265,7 @@ static int __unload_module(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!ast_mutex_lock(&monlock)) {
|
if (!ast_mutex_lock(&monlock)) {
|
||||||
if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
|
if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP) && (monitor_thread != AST_PTHREADT_NULL)) {
|
||||||
pthread_cancel(monitor_thread);
|
pthread_cancel(monitor_thread);
|
||||||
pthread_kill(monitor_thread, SIGURG);
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
pthread_join(monitor_thread, NULL);
|
pthread_join(monitor_thread, NULL);
|
||||||
@@ -8301,6 +8304,7 @@ static int __unload_module(void)
|
|||||||
}
|
}
|
||||||
#ifdef ZAPATA_PRI
|
#ifdef ZAPATA_PRI
|
||||||
for(i=0;i<NUM_SPANS;i++) {
|
for(i=0;i<NUM_SPANS;i++) {
|
||||||
|
if (pris[i].master && (pris[i].master != AST_PTHREADT_NULL))
|
||||||
pthread_join(pris[i].master, NULL);
|
pthread_join(pris[i].master, NULL);
|
||||||
zt_close(pris[i].fds[i]);
|
zt_close(pris[i].fds[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user