[libvirt] [PATCH] Don't fail if SELinux is diabled

but libvirt is built with --with-selinux. In this case getpeercon returns ENOPROTOOPT so dont' return an error in that case but simply don't set seccon. --- src/rpc/virnetsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 39504ac..c4fd9ee 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1171,7 +1171,7 @@ int virNetSocketGetSecurityContext(virNetSocketPtr sock, virObjectLock(sock); if (getpeercon(sock->fd, &seccon) < 0) { - if (errno == ENOSYS) { + if (errno == ENOSYS || errno == ENOPROTOOPT) { ret = 0; goto cleanup; } -- 1.7.10.4

On 03/20/2013 01:04 PM, Guido Günther wrote: s/diabled/disabled/ in the subject
but libvirt is built with --with-selinux. In this case getpeercon returns ENOPROTOOPT so dont' return an error in that case but simply
s/dont'/don't/
don't set seccon. --- src/rpc/virnetsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK.
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 39504ac..c4fd9ee 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -1171,7 +1171,7 @@ int virNetSocketGetSecurityContext(virNetSocketPtr sock,
virObjectLock(sock); if (getpeercon(sock->fd, &seccon) < 0) { - if (errno == ENOSYS) { + if (errno == ENOSYS || errno == ENOPROTOOPT) { ret = 0; goto cleanup; }
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Mar 20, 2013 at 01:10:13PM -0600, Eric Blake wrote:
On 03/20/2013 01:04 PM, Guido Günther wrote:
s/diabled/disabled/ in the subject
but libvirt is built with --with-selinux. In this case getpeercon returns ENOPROTOOPT so dont' return an error in that case but simply
s/dont'/don't/
don't set seccon. --- src/rpc/virnetsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK. Pushed. Thanks, -- Guido

On 03/20/2013 02:06 PM, Guido Günther wrote:
On Wed, Mar 20, 2013 at 01:10:13PM -0600, Eric Blake wrote:
On 03/20/2013 01:04 PM, Guido Günther wrote:
s/diabled/disabled/ in the subject
ACK.
Pushed. Thanks,
Without the typo fix. Oh well. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Mar 20, 2013 at 02:20:52PM -0600, Eric Blake wrote:
On 03/20/2013 02:06 PM, Guido Günther wrote:
On Wed, Mar 20, 2013 at 01:10:13PM -0600, Eric Blake wrote:
On 03/20/2013 01:04 PM, Guido Günther wrote:
s/diabled/disabled/ in the subject
ACK.
Pushed. Thanks,
Without the typo fix. Oh well.
If fixed the dont' part but overlooked that one, sorry. -- Guido
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Guido Günther