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.
This commit is contained in:
Imbus 2026-02-21 08:06:37 +01:00
parent d90c05ca77
commit 1ca6f8dfdf

View file

@ -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);