# HG changeset patch # User Mark Doliner # Date 1166168768 0 # Node ID ae58cf5a441fff9e5fdb8d2abd475f233b93c167 # Parent c65def04fb4411e06111856e4206fe97b3aa9a12 [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 diff -r c65def04fb44 -r ae58cf5a441f libgaim/network.c --- 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 @@ -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) {