diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2015-04-10 23:18:23 -0700 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-05-30 10:40:45 +0000 |
commit | 02e448784543df2d81135ac583c39df6237dac69 (patch) | |
tree | e97467333b40902738f67143c72c631cf8592735 /src/corelib/io | |
parent | 0c5fbd397ceda4d9f0046f1204b5e49229d04312 (diff) |
Correct calculation of filesystem data on unusual filesystems
POSIX.1 says f_blocks, f_bfree, f_bavail are calculated in terms of
f_frsize, not of the regular block size f_bsize. On most systems, it's
the same, which is why we didn't catch it.
I don't have any filesystem to test this on to confirm.
Reference: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_statvfs.h.html
Task-number: QTBUG-45137
Change-Id: I27eaacb532114dd188c4ffff13d3e13016bed4e6
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 2a83e87b0c..cd3c60650e 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -416,9 +416,9 @@ void QStorageInfoPrivate::retreiveVolumeInfo() valid = true; ready = true; - bytesTotal = statfs_buf.f_blocks * statfs_buf.f_bsize; - bytesFree = statfs_buf.f_bfree * statfs_buf.f_bsize; - bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_bsize; + bytesTotal = statfs_buf.f_blocks * statfs_buf.f_frsize; + bytesFree = statfs_buf.f_bfree * statfs_buf.f_frsize; + bytesAvailable = statfs_buf.f_bavail * statfs_buf.f_frsize; #if defined(Q_OS_ANDROID) #if defined(_STATFS_F_FLAGS) readOnly = (statfs_buf.f_flags & ST_RDONLY) != 0; |