std.Io.Threaded: fix sending invalid pointer

OS wants valid control pointer even when len is zero
This commit is contained in:
Andrew Kelley 2025-10-22 06:05:55 -07:00
parent 873bcb5aa6
commit 59ffa607a4

View File

@ -3555,7 +3555,8 @@ fn netSendOne(
.namelen = addressToPosix(message.address, &addr),
.iov = (&iovec)[0..1],
.iovlen = 1,
.control = @constCast(message.control.ptr),
// OS returns EINVAL if this pointer is invalid even if controllen is zero.
.control = if (message.control.len == 0) null else @constCast(message.control.ptr),
.controllen = @intCast(message.control.len),
.flags = 0,
};