diff options
Diffstat (limited to 'channels')
-rwxr-xr-x | channels/chan_mgcp.c | 6 | ||||
-rwxr-xr-x | channels/chan_phone.c | 14 | ||||
-rwxr-xr-x | channels/chan_sip.c | 12 |
3 files changed, 12 insertions, 20 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index fdf6e1dba..09cdfabb0 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -1223,10 +1223,10 @@ static int transmit_notify_request_with_callerid(struct mgcp_endpoint *p, char * char tone2[256]; char *l, *n; time_t t; - struct tm *tm; + struct tm tm; time(&t); - tm = localtime(&t); + localtime_r(&t,&tm); if (callerid) strncpy(cid, callerid, sizeof(cid) - 1); else @@ -1244,7 +1244,7 @@ static int transmit_notify_request_with_callerid(struct mgcp_endpoint *p, char * if (!l) l = ""; snprintf(tone2, sizeof(tone2), "%s,L/ci(%02d/%02d/%02d/%02d,%s,%s)", tone, - tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, l, n); + tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, l, n); strncpy(p->curtone, tone, sizeof(p->curtone) - 1); reqprep(&resp, p, "RQNT"); add_header(&resp, "X", p->txident); diff --git a/channels/chan_phone.c b/channels/chan_phone.c index b8ce778f9..b0a54443a 100755 --- a/channels/chan_phone.c +++ b/channels/chan_phone.c @@ -146,18 +146,18 @@ static int phone_call(struct ast_channel *ast, char *dest, int timeout) PHONE_CID cid; time_t UtcTime; - struct tm *t; + struct tm tm; if (ast->callerid) { time(&UtcTime); - t = localtime(&UtcTime); + localtime_r(&UtcTime,&tm); - if(t != NULL) { - sprintf(cid.month, "%02d",(t->tm_mon + 1)); - sprintf(cid.day, "%02d", t->tm_mday); - sprintf(cid.hour, "%02d", t->tm_hour); - sprintf(cid.min, "%02d", t->tm_min); + if(&tm != NULL) { + sprintf(cid.month, "%02d",(tm.tm_mon + 1)); + sprintf(cid.day, "%02d", tm.tm_mday); + sprintf(cid.hour, "%02d", tm.tm_hour); + sprintf(cid.min, "%02d", tm.tm_min); } strcpy(cid.name, "Unknown"); sprintf(cid.number,"%s",ast->callerid); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 2d6ddcd98..e1322a4d6 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -747,16 +747,8 @@ static void sip_destroy(struct sip_pvt *p) /* Interface lookup code courtesy Tilghman of DrunkCoder.com. Thanks! */ struct my_ifreq { - union - { char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */ - } ifr_ifrn; - - union - { struct sockaddr_in ifru_addr; - char ifru_data[512]; - } ifr_ifru; }; struct in_addr *lookup_iface(char *iface) { @@ -764,7 +756,7 @@ struct in_addr *lookup_iface(char *iface) { int res; static struct my_ifreq ifreq; memset(&ifreq, 0, sizeof(ifreq)); - strncpy(ifreq.ifr_ifrn.ifrn_name,iface,sizeof(ifreq.ifr_ifrn.ifrn_name) - 1); + strncpy(ifreq.ifrn_name,iface,sizeof(ifreq.ifrn_name) - 1); mysock = socket(PF_INET,SOCK_DGRAM,IPPROTO_IP); res = ioctl(mysock,SIOCGIFADDR,&ifreq); @@ -774,7 +766,7 @@ struct in_addr *lookup_iface(char *iface) { ast_log(LOG_WARNING, "Unable to get IP of %s: %s\n", iface, strerror(errno)); return &__ourip; } - return( (struct in_addr *) &ifreq.ifr_ifru.ifru_addr.sin_addr ); + return( (struct in_addr *) &ifreq.ifru_addr.sin_addr ); } static struct in_addr *myaddrfor(struct in_addr *them) |