]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix compilation on Solaris.
authorJason Parker <jparker@digium.com>
Thu, 24 Jan 2008 16:41:29 +0000 (16:41 +0000)
committerJason Parker <jparker@digium.com>
Thu, 24 Jan 2008 16:41:29 +0000 (16:41 +0000)
(closes issue #11832)
Patches:
      bug-11832.diff uploaded by snuffy (license 35)

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

main/acl.c

index 8cc79a3026f65e90a2168763fec3258a5da0bae6..f48459e5777c7684ac0e169d368de5dee7523b80 100644 (file)
@@ -42,7 +42,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <sys/ioctl.h>
-#include <ifaddrs.h>
 
 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__Darwin__)
 #include <fcntl.h>
@@ -51,6 +50,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
 #if defined(SOLARIS)
 #include <sys/sockio.h>
+#include <net/if.h>
+#else
+#include <ifaddrs.h>
 #endif
 
 /* netinet/ip.h may not define the following (See RFCs 791 and 1349) */
@@ -159,8 +161,9 @@ static int get_local_address(struct in_addr *ourip)
        int rtnerr;
        const struct sockaddr_in *sin;
 #endif /* BSD_OR_LINUX */
-       struct in_addr best_addr = { 0, };
+       struct in_addr best_addr;
        int best_score = -100;
+       memset(&best_addr, 0, sizeof(best_addr));
 
 #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
        rtnerr = getifaddrs(&ifaphead);
@@ -218,7 +221,7 @@ static int get_local_address(struct in_addr *ourip)
 
                for (ifr = (struct lifreq *)buf, x = 0; x < ifn.lifn_count; ifr++, x++) {
                        sa = (struct sockaddr_in *)&(ifr->lifr_addr);
-                       score_address(sin, &best_addr, &best_score);
+                       score_address(sa, &best_addr, &best_score);
                        res = 0;
 
                        if (best_score == 0)