From 1ca6f8dfdf0f62051839ee46d28038570212352e Mon Sep 17 00:00:00 2001 From: Imbus Date: Sat, 21 Feb 2026 08:06:37 +0100 Subject: [PATCH] Fix warning in musl related to ioctl Ioctl's in musl take ints, while glibc take unsigned longs. When not using glibc, default to casting the ioctl number to an int. Tests passing. --- writeimg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/writeimg.c b/writeimg.c index f0139ad..2219acb 100644 --- a/writeimg.c +++ b/writeimg.c @@ -278,7 +278,11 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); } +#ifdef __GLIBC__ if (ioctl(fd, BLKGETSIZE64, &device_size) < 0) { +#else /* With musl, ioctl's take ints, kheaders provide unsigned longs. Passes tests. */ + if (ioctl(fd, (int)BLKGETSIZE64, &device_size) < 0) { +#endif perror("ioctl"); close(fd); exit(EXIT_FAILURE);