rupa said this segged
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13550 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b82984fe97
commit
4b4fb6bb2c
|
@ -747,7 +747,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
|
||||||
{
|
{
|
||||||
struct ifaddrs *ifaddrs, *i = NULL;
|
struct ifaddrs *ifaddrs, *i = NULL;
|
||||||
|
|
||||||
if (getifaddrs(&ifaddrs) < 0) {
|
if (!me || getifaddrs(&ifaddrs) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask)
|
||||||
struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr;
|
struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr;
|
||||||
struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask;
|
struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask;
|
||||||
|
|
||||||
if (s->sin_addr.s_addr == me->sin_addr.s_addr) {
|
if (s && m && s->sin_addr.s_addr == me->sin_addr.s_addr) {
|
||||||
*mask = m->sin_addr.s_addr;
|
*mask = m->sin_addr.s_addr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue