about summary refs log tree commit diff
path: root/src/core/platform/nmp-object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/platform/nmp-object.h')
-rw-r--r--src/core/platform/nmp-object.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/platform/nmp-object.h b/src/core/platform/nmp-object.h
index dc2cc86b..19f6bcd7 100644
--- a/src/core/platform/nmp-object.h
+++ b/src/core/platform/nmp-object.h
@@ -34,10 +34,14 @@ typedef union {
     struct sockaddr_in6 in6;
 } NMSockAddrUnion;
 
+G_STATIC_ASSERT(sizeof(NMSockAddrUnion) == sizeof(((NMSockAddrUnion *) NULL)->in6));
+
+/* we initialize the largest union member, to ensure that all fields are initialized. */
+
 #define NM_SOCK_ADDR_UNION_INIT_UNSPEC \
     {                                  \
-        .sa = {                        \
-            .sa_family = AF_UNSPEC,    \
+        .in6 = {                       \
+            .sin6_family = AF_UNSPEC,  \
         },                             \
     }