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

Martin Kletzander mkletzan at redhat.com
Sun Jan 10 10:02:15 UTC 2016


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160110/a7283449/attachment-0001.sig>


More information about the libvir-list mailing list