[libvirt] [PATCH] Make sure struct sockaddr_in is defined on FreeBSD

--- src/util/network.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/util/network.h b/src/util/network.h index 0900e29..724a5f8 100644 --- a/src/util/network.h +++ b/src/util/network.h @@ -21,6 +21,10 @@ # include <netdb.h> # include <stdbool.h> +# ifdef __FreeBSD__ +# include <netinet/in.h> +# endif + typedef struct { union { struct sockaddr sa; -- 1.7.0.4

On 11/13/2010 08:52 AM, Matthias Bolte wrote:
--- src/util/network.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/util/network.h b/src/util/network.h index 0900e29..724a5f8 100644 --- a/src/util/network.h +++ b/src/util/network.h @@ -21,6 +21,10 @@ # include <netdb.h> # include <stdbool.h>
+# ifdef __FreeBSD__ +# include <netinet/in.h> +# endif +
NACK as written. POSIX states that <netdb.h> may, but not must, define sockaddr_in. Therefore, the correct fix is to unconditionally include <netinet/in.h>, which is the only header guaranteed by POSIX to declare that struct. (That is, turn your four-line addition into a two-line addition - it doesn't hurt to make the include unconditional). ACK with that change. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/11/13 Eric Blake <eblake@redhat.com>:
On 11/13/2010 08:52 AM, Matthias Bolte wrote:
--- src/util/network.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/util/network.h b/src/util/network.h index 0900e29..724a5f8 100644 --- a/src/util/network.h +++ b/src/util/network.h @@ -21,6 +21,10 @@ # include <netdb.h> # include <stdbool.h>
+# ifdef __FreeBSD__ +# include <netinet/in.h> +# endif +
NACK as written. POSIX states that <netdb.h> may, but not must, define sockaddr_in.
Therefore, the correct fix is to unconditionally include <netinet/in.h>, which is the only header guaranteed by POSIX to declare that struct. (That is, turn your four-line addition into a two-line addition - it doesn't hurt to make the include unconditional). ACK with that change.
Okay, I removed the condition and pushed the result. Matthias
participants (2)
-
Eric Blake
-
Matthias Bolte