mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
Use struct sockpeercred when available
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@gmail.com>
This commit is contained in:
parent
1b60f1b401
commit
91b423beb7
@ -393,6 +393,12 @@ 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/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>
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user