8266797: Fix for 8266610 breaks the build on macos

Reviewed-by: dholmes, jdv
This commit is contained in:
Vyom Tewari 2021-05-10 13:40:28 +00:00
parent 53db2a0acd
commit b823b3ef29

View File

@ -32,6 +32,9 @@
#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
#include <sys/ioctl.h>
#endif
#if defined(__linux__)
#include <linux/fs.h>
#include <sys/stat.h>
#endif
@ -250,7 +253,7 @@ handleGetLength(FD fd)
if (result < 0) {
return -1;
}
#ifdef BLKGETSIZE64
#if defined(__linux__) && defined(BLKGETSIZE64)
if (S_ISBLK(sb.st_mode)) {
uint64_t size;
if(ioctl(fd, BLKGETSIZE64, &size) < 0) {
@ -258,6 +261,6 @@ handleGetLength(FD fd)
}
return (jlong)size;
}
#endif
#endif
return sb.st_size;
}