ext/libuv/src/unix/stream.c in libuv-3.1.4 vs ext/libuv/src/unix/stream.c in libuv-3.1.5
- old
+ new
@@ -783,20 +783,25 @@
if (req->send_handle) {
struct msghdr msg;
struct cmsghdr *cmsg;
int fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle);
- char scratch[64] = {0};
+ union {
+ char data[64];
+ struct cmsghdr alias;
+ } scratch;
+ memset(&scratch, 0, sizeof(scratch));
+
assert(fd_to_send >= 0);
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = iov;
msg.msg_iovlen = iovcnt;
msg.msg_flags = 0;
- msg.msg_control = (void*) scratch;
+ msg.msg_control = &scratch.alias;
msg.msg_controllen = CMSG_SPACE(sizeof(fd_to_send));
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;