aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2025-02-05 16:57:55 +0100
committerStefano Brivio <sbrivio@redhat.com>2025-02-06 09:40:54 +0100
commit9215f68a0c2ad274b73862bc865fbdbb464e182a (patch)
treeccd89da78322a97887771e0469741b86d881b083
parenta9d63f91a59a4c02cd77af41fa70d82e73f17576 (diff)
downloadpasst-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar.gz
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar.bz2
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar.lz
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar.xz
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.tar.zst
passt-9215f68a0c2ad274b73862bc865fbdbb464e182a.zip
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 <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--passt-repair.c7
1 files changed, 6 insertions, 1 deletions
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 <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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) {