From: Jasper Lievisse Adriaanse <jasper@xxxxxxxxxxx> 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@xxxxxxxxx> --- 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> + ]]) + AC_CHECK_DECLS([ETH_FLAG_TXVLAN, ETH_FLAG_NTUPLE, ETH_FLAG_RXHASH, ETH_FLAG_LRO, ETHTOOL_GGSO, ETHTOOL_GGRO, ETHTOOL_GFLAGS, ETHTOOL_GFEATURES], [], [], [[#include <linux/ethtool.h> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 526d291..4f67c8f 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1259,7 +1259,11 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock, pid_t *pid, unsigned long long *timestamp) { +# if defined(HAVE_STRUCT_SOCKPEERCRED) + struct sockpeercred cr; +# else struct ucred cr; +# endif socklen_t cr_len = sizeof(cr); int ret = -1; -- 2.4.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list