Disk: use statvfs64 only when __USE_LARGEFILE64 is defined

This commit is contained in:
李通洲
2022-11-20 19:43:02 +08:00
parent b6b95581cd
commit 1c69d6c788
+9 -3
View File
@@ -73,9 +73,15 @@ void ffDetectDisksImpl(FFDiskResult* disks)
#endif
//Detects stats
struct statvfs64 fs;
if(statvfs64(disk->mountpoint.chars, &fs) != 0)
memset(&fs, 0, sizeof(struct statvfs64)); //Set all values to 0, so our values get initialized to 0 too
#ifdef __USE_LARGEFILE64
struct statvfs64 fs;
if(statvfs64(disk->mountpoint.chars, &fs) != 0)
memset(&fs, 0, sizeof(struct statvfs64)); //Set all values to 0, so our values get initialized to 0 too
#else
struct statvfs fs;
if(statvfs(disk->mountpoint.chars, &fs) != 0)
memset(&fs, 0, sizeof(struct statvfs)); //Set all values to 0, so our values get initialized to 0 too
#endif
disk->bytesTotal = fs.f_blocks * fs.f_frsize;
disk->bytesUsed = disk->bytesTotal - (fs.f_bavail * fs.f_frsize);