From 9215f68a0c2ad274b73862bc865fbdbb464e182a Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 5 Feb 2025 16:57:55 +0100 Subject: passt-repair: Build fixes for musl When building against musl headers: - sizeof() needs stddef.h, as it should be; - we can't initialise a struct msghdr by simply listing fields in order, as they contain explicit padding fields. Use field names instead. Signed-off-by: Stefano Brivio Reviewed-by: David Gibson --- passt-repair.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/passt-repair.c b/passt-repair.c index 6f79423..3c3247b 100644 --- a/passt-repair.c +++ b/passt-repair.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -75,7 +76,11 @@ int main(int argc, char **argv) } iov = (struct iovec){ &cmd, sizeof(cmd) }; - msg = (struct msghdr){ NULL, 0, &iov, 1, buf, sizeof(buf), 0 }; + msg = (struct msghdr){ .msg_name = NULL, .msg_namelen = 0, + .msg_iov = &iov, .msg_iovlen = 1, + .msg_control = buf, + .msg_controllen = sizeof(buf), + .msg_flags = 0 }; cmsg = CMSG_FIRSTHDR(&msg); if (argc != 2) { -- cgit v1.2.3