Commit f130df92 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

util-net: Zeroify structures

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 86392b7f
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd) int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd)
{ {
struct msghdr hdr;
struct iovec data;
char cmsgbuf[CMSG_SPACE(sizeof(int))]; char cmsgbuf[CMSG_SPACE(sizeof(int))];
struct msghdr hdr = { };
struct iovec data = { };
struct cmsghdr* cmsg; struct cmsghdr* cmsg;
int *cmsg_data; int *cmsg_data;
char dummy = '*'; char dummy = '*';
...@@ -19,7 +19,6 @@ int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd) ...@@ -19,7 +19,6 @@ int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd)
hdr.msg_namelen = len; hdr.msg_namelen = len;
hdr.msg_iov = &data; hdr.msg_iov = &data;
hdr.msg_iovlen = 1; hdr.msg_iovlen = 1;
hdr.msg_flags = 0;
hdr.msg_control = &cmsgbuf; hdr.msg_control = &cmsgbuf;
hdr.msg_controllen = CMSG_LEN(sizeof(int)); hdr.msg_controllen = CMSG_LEN(sizeof(int));
...@@ -37,18 +36,17 @@ int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd) ...@@ -37,18 +36,17 @@ int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd)
int recv_fd(int sock) int recv_fd(int sock)
{ {
struct msghdr msg;
struct iovec iov;
char buf[1];
char ccmsg[CMSG_SPACE(sizeof(int))]; char ccmsg[CMSG_SPACE(sizeof(int))];
struct msghdr msg = { };
struct iovec iov = { };
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
int *cmsg_data; int *cmsg_data;
char buf[1];
int ret;
iov.iov_base = buf; iov.iov_base = buf;
iov.iov_len = 1; iov.iov_len = 1;
int ret;
msg.msg_name = 0;
msg.msg_namelen = 0;
msg.msg_iov = &iov; msg.msg_iov = &iov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
msg.msg_control = ccmsg; msg.msg_control = ccmsg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment