[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Incorrect detection of member sa_len.
From: |
Mats E Andersson |
Subject: |
Incorrect detection of member sa_len. |
Date: |
Sat, 9 Apr 2011 14:23:27 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Dear all,
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.
In fact, this flawed test takes precedence over an otherwise
sound and correct test implemented in GNU Inetutils, thus
producing a false negative on OpenBSD and FreeBSD. It is
easily observered that, after executing the bootstrap script
shipped for GNU Inetutils, the resulting `configure` contains
two tests for `sa_len`, one correct and the other wrong.
Unluckily the wrong one gets to determine `config.h`
Best regards,
Mats Erik Andersson, member of GNU Inetutils
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index 94c276f..2662093 100644
--- 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])