[libvirt] [PATCH 2/2] Use struct sockpeercred when available

Roman Bogorodskiy bogorodskiy at gmail.com
Sun Jan 10 19:48:14 UTC 2016


  Martin Kletzander wrote:

> On Fri, Jan 08, 2016 at 10:36:08PM +0300, Roman Bogorodskiy wrote:
> >From: Jasper Lievisse Adriaanse <jasper at 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 at 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.

Yeah, it actually seems to go fine without sys/types.h (tested in
isolation), so I'll drop that. Thanks for noticing that!

Roman Bogorodskiy




More information about the libvir-list mailing list