[asterisk-commits] tilghman: branch 1.4 r99643 - /branches/1.4/main/acl.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 14:34:55 CST 2008


Author: tilghman
Date: Tue Jan 22 14:34:55 2008
New Revision: 99643

URL: http://svn.digium.com/view/asterisk?view=rev&rev=99643
Log:
Fix the defines for OS X (and Solaris, too)

Modified:
    branches/1.4/main/acl.c

Change Statistics:
 0 files changed

Modified: branches/1.4/main/acl.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/acl.c?view=diff&rev=99643&r1=99642&r2=99643
==============================================================================
--- branches/1.4/main/acl.c (original)
+++ branches/1.4/main/acl.c Tue Jan 22 14:34:55 2008
@@ -43,7 +43,7 @@
 #include <netinet/ip.h>
 #include <sys/ioctl.h>
 
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__Darwin__)
 #include <fcntl.h>
 #include <net/route.h>
 #endif
@@ -52,7 +52,7 @@
 #include <sys/sockio.h>
 #endif
 
-#if defined(__linux__)
+#if defined(__Darwin__) || defined(__linux__)
 #include <ifaddrs.h>
 #endif
 
@@ -149,23 +149,23 @@
 static int get_local_address(struct in_addr *ourip)
 {
 	int s, res = -1;
-#ifdef _SOLARIS
+#ifdef SOLARIS
 	struct lifreq *ifr = NULL;
 	struct lifnum ifn;
 	struct lifconf ifc;
 	struct sockaddr_in *sa;
 	char *buf = NULL;
 	int bufsz, x;
-#endif /* _SOLARIS */
-#if defined(_BSD) || defined(__linux__)
+#endif /* SOLARIS */
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	struct ifaddrs *ifap, *ifaphead;
 	int rtnerr;
 	const struct sockaddr_in *sin;
-#endif /* defined(_BSD) || defined(_LINUX) */
+#endif /* BSD_OR_LINUX */
 	struct in_addr best_addr = { 0, };
 	int best_score = -100;
 
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	rtnerr = getifaddrs(&ifaphead);
 	if (rtnerr) {
 		perror(NULL);
@@ -176,7 +176,7 @@
 	s = socket(AF_INET, SOCK_STREAM, 0);
 
 	if (s > 0) {
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 		for (ifap = ifaphead; ifap; ifap = ifap->ifa_next) {
 
 			if (ifap->ifa_addr->sa_family == AF_INET) {
@@ -188,10 +188,10 @@
 					break;
 			}
 		}
-#endif /* _BSD */
+#endif /* BSD_OR_LINUX */
 
 		/* There is no reason whatsoever that this shouldn't work on Linux or BSD also. */
-#ifdef _SOLARIS
+#ifdef SOLARIS
 		/* Get a count of interfaces on the machine */
 		ifn.lifn_family = AF_INET;
 		ifn.lifn_flags = 0;
@@ -229,13 +229,13 @@
 		}
 
 		free(buf);
-#endif /* _SOLARIS */
+#endif /* SOLARIS */
 		
 		close(s);
 	}
-#if defined(_BSD) || defined(__linux__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__linux__) || defined(__Darwin__)
 	freeifaddrs(ifaphead);
-#endif
+#endif /* BSD_OR_LINUX */
 
 	if (res == 0 && ourip)
 		memcpy(ourip, &best_addr, sizeof(*ourip));




More information about the asterisk-commits mailing list