[PATCH 3/3] util: Standardize macro usage to check socket family

Julio Faracco posted 3 patches 2 days, 22 hours ago
[PATCH 3/3] util: Standardize macro usage to check socket family
Posted by Julio Faracco 2 days, 22 hours ago
Replace direct socket family comparison with the standard
VIR_SOCKET_ADDR_IS_FAMILY() macro for consistency.

The codebase uses VIR_SOCKET_ADDR_IS_FAMILY() as the standard way
to check socket address families. This patch updates one remaining
instance that was using direct field access
(addr->data.sa.sa_family == AF_UNIX) to use the macro instead.

This improves code consistency and makes the code more maintainable
by centralizing the family checking logic.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/util/virsocketaddr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 80ee3b4c51..c5ac1b360a 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -479,7 +479,7 @@ virSocketAddrFormatFull(const virSocketAddr *addr,
 
     /* Short-circuit since getnameinfo doesn't work
      * nicely for UNIX sockets */
-    if (addr->data.sa.sa_family == AF_UNIX) {
+    if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_UNIX)) {
         if (withService) {
             addrstr = g_strdup_printf(VIR_LOOPBACK_IPV4_ADDR "%s0",
                                       separator ? separator : ":");
-- 
2.52.0