]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: fix build on BSD
authorEric Blake <eblake@redhat.com>
Thu, 17 Jan 2013 23:29:38 +0000 (16:29 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 17 Jan 2013 23:39:10 +0000 (16:39 -0700)
A build on FreeBSD failed with:
util/virportallocator.c:108: error: storage size of 'addr' isn't known
util/virportallocator.c:123: error: 'INADDR_ANY' undeclared (first use in this function)

It turns out that while POSIX allows sockaddr_in to leak in through
<arpa/inet.h> (the way Linux does it), it is not mandatory, and
conforming applications are required to get it through <netinet/in.h>.

* src/util/virportallocator.c: Include header for struct
sockaddr_in.
* tests/virportallocatortest.c: Likewise.

src/util/virportallocator.c
tests/virportallocatortest.c

index 35f2157a41bb5a79ca11d60b8368d3d0b3f03454..590bb570f6cd866e5a248f682f65c011319f1e5f 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 
 #include "viralloc.h"
 #include "virbitmap.h"
index 3f6edcc3947c94b6daced737626489b862a88e89..9931e11638acfe33c79cb64c0d7ad89db4df9568 100644 (file)
@@ -25,6 +25,7 @@
 # include <sys/socket.h>
 # include <errno.h>
 # include <arpa/inet.h>
+# include <netinet/in.h>
 
 int bind(int sockfd ATTRIBUTE_UNUSED,
          const struct sockaddr *addr,