Make sure SIOGLIFCONF buffer is properly aligned for socket structures

This commit is contained in:
Alan Coopersmith 2008-03-04 16:03:04 -08:00
parent 27e7dacbf7
commit cf984dcc15

View File

@ -713,19 +713,21 @@ void
DefineSelf (int fd) DefineSelf (int fd)
{ {
#ifndef HAS_GETIFADDRS #ifndef HAS_GETIFADDRS
char buf[2048], *cp, *cplim; char *cp, *cplim;
void * bufptr = buf; # ifdef USE_SIOCGLIFCONF
#ifdef USE_SIOCGLIFCONF struct sockaddr_storage buf[16];
struct lifconf ifc; struct lifconf ifc;
register struct lifreq *ifr; register struct lifreq *ifr;
#ifdef SIOCGLIFNUM # ifdef SIOCGLIFNUM
struct lifnum ifn; struct lifnum ifn;
#endif # endif
#else # else /* !USE_SIOCGLIFCONF */
char buf[2048];
struct ifconf ifc; struct ifconf ifc;
register struct ifreq *ifr; register struct ifreq *ifr;
#endif # endif
#else void * bufptr = buf;
#else /* HAS_GETIFADDRS */
struct ifaddrs * ifap, *ifr; struct ifaddrs * ifap, *ifr;
#endif #endif
int len; int len;