build: fix build on BSD

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.
This commit is contained in:
Eric Blake 2013-01-17 16:29:38 -07:00
parent 7d31dd6494
commit f403bdc189
2 changed files with 2 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include "viralloc.h"
#include "virbitmap.h"

View 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,