[PATCH] virNetSocketCheckProtocols: Actually check bool value

Michal Privoznik posted 1 patch 3 years, 9 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/0dcf9562e23edaab7451ec6af7e1c2a4f9800ac8.1594995431.git.mprivozn@redhat.com
src/rpc/virnetsocket.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] virNetSocketCheckProtocols: Actually check bool value
Posted by Michal Privoznik 3 years, 9 months ago
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>
---

Pushed under trivial rule.

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

diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 45dcf48206..5a7f501923 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -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;
 
-- 
2.26.2