chiark / gitweb /
Use initalization instead of explicit zeroing
[elogind.git] / src / nspawn / nspawn.c
index 01ef12bf67bbbf0dda4095bad7d2bb037988dd15..b90ccc53ef51fae8d4ffaf29cb7ce6463761a789 100644 (file)
@@ -674,8 +674,11 @@ static int setup_kmsg(const char *dest, int kmsg_socket) {
         union {
                 struct cmsghdr cmsghdr;
                 uint8_t buf[CMSG_SPACE(sizeof(int))];
-        } control;
-        struct msghdr mh;
+        } control = {};
+        struct msghdr mh = {
+                .msg_control = &control,
+                .msg_controllen = sizeof(control),
+        };
         struct cmsghdr *cmsg;
 
         assert(dest);
@@ -716,12 +719,6 @@ static int setup_kmsg(const char *dest, int kmsg_socket) {
                 return -errno;
         }
 
-        zero(mh);
-        zero(control);
-
-        mh.msg_control = &control;
-        mh.msg_controllen = sizeof(control);
-
         cmsg = CMSG_FIRSTHDR(&mh);
         cmsg->cmsg_level = SOL_SOCKET;
         cmsg->cmsg_type = SCM_RIGHTS;