fish: fully init the msghdr buffers

This way no fields (msg_flags in particular) remain uninitialized.
This commit is contained in:
Pino Toscano
2017-03-03 11:00:37 +01:00
parent bd55fa553f
commit be82ba38df

View File

@@ -101,14 +101,13 @@ receive_stdout (int s)
int fd;
char buf[1];
memset (&msg, 0, sizeof msg);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
iov.iov_base = buf;
iov.iov_len = sizeof buf;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = control_un.control;
msg.msg_controllen = sizeof (control_un.control);
@@ -163,6 +162,7 @@ send_stdout (int s)
* It's unclear if this is hiding a real problem or not. XXX
*/
memset (&control_un, 0, sizeof control_un);
memset (&msg, 0, sizeof msg);
/* On Linux you have to transmit at least 1 byte of real data. */
msg.msg_iov = &iov;
@@ -171,9 +171,6 @@ send_stdout (int s)
iov.iov_base = buf;
iov.iov_len = sizeof buf;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_control = control_un.control;
msg.msg_controllen = sizeof (control_un.control);