core_unix
core_unix copied to clipboard
fix build on musl
msghdr in musl has padding field
@dkalinichenko-js @gretay-js (hope I'm pinging the right people here; if not, please forward)
This patch fixes the following compilation error, and it would be nice if it could get merged:
linux_ext_stubs.c: In function ‘core_linux_sendmsg_nonblocking_no_sigpipe_stub’:
linux_ext_stubs.c:239:45: error: initialization of ‘int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
239 | struct msghdr msghdr = {NULL, 0, NULL, 0, NULL, 0, 0};
| ^~~~
linux_ext_stubs.c:239:45: note: (near initialization for ‘msghdr.__pad1’)
Note that there is an existing use of this in this codebase with a single NULL, which works fine:
https://github.com/janestreet/core_unix/blob/95ccb142bca9fb4495b6ab1a9107d78e578c26af/bigstring_unix/src/bigstring_unix_stubs.c#L750