]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virNetSocketCheckProtocols: Actually check bool value
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 17 Jul 2020 14:14:23 +0000 (16:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 17 Jul 2020 14:14:23 +0000 (16:14 +0200)
In 9536379da4c8ed61 and 8b0cb0e666f I've tried to call
virNetSocketCheckProtocolByLookup() only if we are suspecting the
host is IPv4 or IPv6 capable (because we've found an interface
with such address). However, the code was missing dereference of
the boolean variables and thus was comparing pointers against
NULL.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/rpc/virnetsocket.c

index 45dcf48206eb61127440ef0f0e37eb10ef7c33e6..5a7f5019233a7719d44f13ed467d998704965210 100644 (file)
@@ -205,11 +205,11 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
 
     freeifaddrs(ifaddr);
 
-    if (hasIPv4 &&
+    if (*hasIPv4 &&
         virNetSocketCheckProtocolByLookup("127.0.0.1", AF_INET, hasIPv4) < 0)
         return -1;
 
-    if (hasIPv6 &&
+    if (*hasIPv6 &&
         virNetSocketCheckProtocolByLookup("::1", AF_INET6, hasIPv6) < 0)
         return -1;