chiark / gitweb /
core/main: use _cleanup_
[elogind.git] / src / shared / log.c
index 876f22dfc5535af48c10255c553324dc04302f5a..27317f7ed3ce13c4811d8ad53fa311f6e7b9e785 100644 (file)
@@ -737,7 +737,9 @@ int log_struct_internal(
                 char header[LINE_MAX];
                 struct iovec iovec[17] = {};
                 unsigned n = 0, i;
                 char header[LINE_MAX];
                 struct iovec iovec[17] = {};
                 unsigned n = 0, i;
-                struct msghdr mh;
+                struct msghdr mh = {
+                        .msg_iov = iovec,
+                };
                 static const char nl = '\n';
 
                 /* If the journal is available do structured logging */
                 static const char nl = '\n';
 
                 /* If the journal is available do structured logging */
@@ -775,8 +777,6 @@ int log_struct_internal(
                         format = va_arg(ap, char *);
                 }
 
                         format = va_arg(ap, char *);
                 }
 
-                zero(mh);
-                mh.msg_iov = iovec;
                 mh.msg_iovlen = n;
 
                 if (sendmsg(journal_fd, &mh, MSG_NOSIGNAL) < 0)
                 mh.msg_iovlen = n;
 
                 if (sendmsg(journal_fd, &mh, MSG_NOSIGNAL) < 0)