Re: [libvirt] [PATCH] Use sockpeercred on OpenBSD.

2012-09-04 Thread Jasper Lievisse Adriaanse
On Tue, Sep 04, 2012 at 09:22:56AM -0600, Eric Blake wrote:
> On 09/04/2012 09:00 AM, Jasper Lievisse Adriaanse wrote:
> >>From 0f352c0577f76a64924636a8c9ba72de5862b6d6 Mon Sep 17 00:00:00 2001
> > From: Jasper Lievisse Adriaanse 
> > Date: Tue, 4 Sep 2012 16:59:55 +0200
> > Subject: [PATCH] Use sockpeercred on OpenBSD.
> > 
> > ---
> >  src/rpc/virnetsocket.c |4 
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> I _hate_ OS-specific #ifdefs.  I'd much rather see a configure-time
> check to determine whether 'struct ucred', 'struct sockpeercred', or
> both, exist, and then base the decision on which struct to use based on
> the result of that configure-time check.
> 
> > 
> > diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
> > index 5a48300..27ead13 100644
> > --- a/src/rpc/virnetsocket.c
> > +++ b/src/rpc/virnetsocket.c
> > @@ -988,7 +988,11 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
> >  gid_t *gid,
> >  pid_t *pid)
> >  {
> > +#if defined (__OpenBSD__)
> > +struct sockpeercred cr;
> > +#else
> >  struct ucred cr;
> > +#endif
> >  socklen_t cr_len = sizeof(cr);
> >  virMutexLock(&sock->lock);
> 
> Give me some time to try to help turn this into a proper configure-time
> check.
Great, thanks!
 
> -- 
> Eric Blake   ebl...@redhat.com+1-919-301-3266
> Libvirt virtualization library http://libvirt.org
> 



-- 
Cheers,
Jasper

"Stay Hungry. Stay Foolish"

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Use sockpeercred on OpenBSD.

2012-09-04 Thread Eric Blake
On 09/04/2012 09:00 AM, Jasper Lievisse Adriaanse wrote:
>>From 0f352c0577f76a64924636a8c9ba72de5862b6d6 Mon Sep 17 00:00:00 2001
> From: Jasper Lievisse Adriaanse 
> Date: Tue, 4 Sep 2012 16:59:55 +0200
> Subject: [PATCH] Use sockpeercred on OpenBSD.
> 
> ---
>  src/rpc/virnetsocket.c |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)

I _hate_ OS-specific #ifdefs.  I'd much rather see a configure-time
check to determine whether 'struct ucred', 'struct sockpeercred', or
both, exist, and then base the decision on which struct to use based on
the result of that configure-time check.

> 
> diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
> index 5a48300..27ead13 100644
> --- a/src/rpc/virnetsocket.c
> +++ b/src/rpc/virnetsocket.c
> @@ -988,7 +988,11 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
>  gid_t *gid,
>  pid_t *pid)
>  {
> +#if defined (__OpenBSD__)
> +struct sockpeercred cr;
> +#else
>  struct ucred cr;
> +#endif
>  socklen_t cr_len = sizeof(cr);
>  virMutexLock(&sock->lock);

Give me some time to try to help turn this into a proper configure-time
check.

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] Use sockpeercred on OpenBSD.

2012-09-04 Thread Jasper Lievisse Adriaanse
>From 0f352c0577f76a64924636a8c9ba72de5862b6d6 Mon Sep 17 00:00:00 2001
From: Jasper Lievisse Adriaanse 
Date: Tue, 4 Sep 2012 16:59:55 +0200
Subject: [PATCH] Use sockpeercred on OpenBSD.

---
 src/rpc/virnetsocket.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 5a48300..27ead13 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -988,7 +988,11 @@ int virNetSocketGetUNIXIdentity(virNetSocketPtr sock,
 gid_t *gid,
 pid_t *pid)
 {
+#if defined (__OpenBSD__)
+struct sockpeercred cr;
+#else
 struct ucred cr;
+#endif
 socklen_t cr_len = sizeof(cr);
 virMutexLock(&sock->lock);
 
-- 
1.7.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list