Hello Mats, > the m4 helper in `m4/getaddrinfo.m4` is incorrectly implementing > a test whether `struct sockaddr` contains a member `sa_len`. > > Any BSD system must include `<sys/types.h>` in order for the test > code to deliver a trustworthy answer. As always this header must > precede `<sys/socket.h>` on any BSD system.
You're right: this is a known bug of many BSD systems, see <http://www.gnu.org/software/gnulib/manual/html_node/sys_002fsocket_002eh.html> > --- a/m4/getaddrinfo.m4 > +++ b/m4/getaddrinfo.m4 > @@ -105,7 +105,9 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [ > > dnl Including sys/socket.h is wrong for Windows, but Windows does not > dnl have sa_len so the result is correct anyway. > - AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [#include <sys/socket.h>]) > + AC_CHECK_MEMBERS([struct sockaddr.sa_len], , , [ > +#include <sys/types.h> > +#include <sys/socket.h>]) > > AC_CHECK_HEADERS_ONCE([netinet/in.h]) > I've applied this patch in your name with this ChangeLog entry. (The marker "tiny change" means that no copyright assignment was needed for this patch.) Thank you! 2011-04-09 Mats Erik Andersson <[email protected]> (tiny change) getaddrinfo: Fix test for sa_len member. * m4/getaddrinfo.m4 (gl_PREREQ_GETADDRINFO): When testing for sa_len, include <sys/types.h> before <sys/socket.h>. -- In memoriam Georg Elser <http://en.wikipedia.org/wiki/Georg_Elser>
