]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/hv/hv_kvp_daemon.c
Tools: hv: use full nlmsghdr in netlink_send
[karo-tx-linux.git] / tools / hv / hv_kvp_daemon.c
index dca06a26ee2a65de6478044832a065ac5b230a51..8fd9ec66121c111b5bcfc29fd6e0e286f125ad67 100644 (file)
@@ -1392,23 +1392,18 @@ kvp_get_domain_name(char *buffer, int length)
 static int
 netlink_send(int fd, struct cn_msg *msg)
 {
-       struct nlmsghdr *nlh;
+       struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE };
        unsigned int size;
        struct msghdr message;
-       char buffer[64];
        struct iovec iov[2];
 
        size = sizeof(struct cn_msg) + msg->len;
 
-       nlh = (struct nlmsghdr *)buffer;
-       nlh->nlmsg_seq = 0;
-       nlh->nlmsg_pid = getpid();
-       nlh->nlmsg_type = NLMSG_DONE;
-       nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh));
-       nlh->nlmsg_flags = 0;
+       nlh.nlmsg_pid = getpid();
+       nlh.nlmsg_len = NLMSG_LENGTH(size);
 
-       iov[0].iov_base = nlh;
-       iov[0].iov_len = sizeof(*nlh);
+       iov[0].iov_base = &nlh;
+       iov[0].iov_len = sizeof(nlh);
 
        iov[1].iov_base = msg;
        iov[1].iov_len = size;