changeset 15216:ae58cf5a441f

[gaim-migrate @ 18006] Another bug fix from Graham Booker to allow gaim_network_get_local_system_ip() to work correctly/reliably on Mac OS X (and probably some BSDs) committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 15 Dec 2006 07:46:08 +0000
parents c65def04fb44
children 717935e035ca
files libgaim/network.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/network.c	Fri Dec 15 07:28:23 2006 +0000
+++ b/libgaim/network.c	Fri Dec 15 07:46:08 2006 +0000
@@ -47,6 +47,16 @@
 #include "stun.h"
 #include "upnp.h"
 
+/*
+ * Calling sizeof(struct ifreq) isn't always correct on
+ * Mac OS X (and maybe others).
+ */
+#ifdef _SIZEOF_ADDR_IFREQ
+#  define HX_SIZE_OF_IFREQ(a) _SIZEOF_ADDR_IFREQ(a)
+#else
+#  define HX_SIZE_OF_IFREQ(a) sizeof(a)
+#endif
+
 #ifdef HAVE_LIBNM
 #include <libnm_glib.h>
 
@@ -135,7 +145,7 @@
 	while (tmp < buffer + ifc.ifc_len)
 	{
 		ifr = (struct ifreq *)tmp;
-		tmp += sizeof(struct ifreq);
+		tmp += HX_SIZE_OF_IFREQ(*ifr);
 
 		if (ifr->ifr_addr.sa_family == AF_INET)
 		{