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:
parent
d90c05ca77
commit
1ca6f8dfdf
1 changed files with 4 additions and 0 deletions
|
|
@ -278,7 +278,11 @@ int main(int argc, char *argv[]) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __GLIBC__
|
||||||
if (ioctl(fd, BLKGETSIZE64, &device_size) < 0) {
|
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");
|
perror("ioctl");
|
||||||
close(fd);
|
close(fd);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue