Fri, 15 Dec 2006 07:46:08 +0000
[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)
| libgaim/network.c | file | annotate | diff | comparison | revisions |
--- 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) {