On Fri, Jan 08, 2016 at 10:36:08PM +0300, Roman Bogorodskiy wrote:
From: Jasper Lievisse Adriaanse <jasper(a)openbsd.org>
OpenBSD uses 'struct sockpeercred' instead of 'struct ucred'. Add a
configure check that detects its presence and use if in the code that
could be compiled on OpenBSD.
Signed-off-by: Roman Bogorodskiy <bogorodskiy(a)gmail.com>
---
configure.ac | 7 +++++++
src/rpc/virnetsocket.c | 4 ++++
2 files changed, 11 insertions(+)
diff --git a/configure.ac b/configure.ac
index a566f5b..4a83e5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -393,6 +393,13 @@ AC_CHECK_TYPE([struct ifreq],
#include <net/if.h>
]])
+AC_CHECK_TYPE([struct sockpeercred],
+ [AC_DEFINE([HAVE_STRUCT_SOCKPEERCRED], [1],
+ [Defined if struct sockpeercred is available])],
+ [], [[#include <sys/types.h>
+ #include <sys/socket.h>
Either sys/types.h is not needed or the build for virnetsocket.c should
fail as it is not included there. It might be included transitively
through some other files, but would be nice if we either specified it
there as well or cleaned it up from here.