Bug 918140 - mis-interprets disk "hard quota" (blocks vs bytes confusion). r=benjamin

This commit is contained in:
Paul Szabo 2014-11-23 22:20:38 +02:00
parent 7ca0fddc23
commit abb3ffd658

View File

@ -11,6 +11,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h"
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -1407,10 +1408,9 @@ nsLocalFile::GetDiskSpaceAvailable(int64_t* aDiskSpaceAvailable)
#endif
&& dq.dqb_bhardlimit) {
int64_t QuotaSpaceAvailable = 0;
if (dq.dqb_bhardlimit > dq.dqb_curspace) {
QuotaSpaceAvailable =
int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
}
// dqb_bhardlimit is count of BLOCK_SIZE blocks, dqb_curspace is bytes
if ((BLOCK_SIZE * dq.dqb_bhardlimit) > dq.dqb_curspace)
QuotaSpaceAvailable = int64_t(BLOCK_SIZE * dq.dqb_bhardlimit - dq.dqb_curspace);
if (QuotaSpaceAvailable < *aDiskSpaceAvailable) {
*aDiskSpaceAvailable = QuotaSpaceAvailable;
}