From 83d508bddb09e20851dfe4ce7bd4c910a6f3a9cd Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 22 Nov 2016 19:04:02 +0100 Subject: [PATCH] Fixed: CSystemInfo::availableHDSpace implementation under Unix --- code/nel/src/misc/system_info.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 9bea47e29..680329dcf 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -1387,13 +1387,10 @@ uint64 CSystemInfo::availableHDSpace (const string &filename) std::string path = CFile::getPath(filename); #ifdef NL_OS_UNIX - struct stat stst; struct statfs stfs; + if (::statfs(path.c_str(), &stfs) != 0) return 0; - if (::stat(path.c_str(), &stst) == -1) return 0; - if (::statfs(path.c_str(), &stfs) == -1) return 0; - - return (uint64)(stfs.f_bavail * stst.st_blksize); + return (uint64)(stfs.f_bavail * stfs.f_bsize); #else ULARGE_INTEGER freeSpace = {0}; BOOL bRes = ::GetDiskFreeSpaceExW(utf8ToWide(path), &freeSpace, NULL, NULL);