diff options
author | Jeremy Allison <jra@samba.org> | 2008-10-13 17:27:53 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-10-13 17:27:53 -0700 |
commit | 501fa6a05db1b2c29b1e4720a03ed219aee2a346 (patch) | |
tree | 21841c344f878f9ba8af2fb06018933f70069f22 /lib | |
parent | ddf16ed6e5d68870cdf3b8c6358af5134a694fc4 (diff) | |
parent | 7e5bbe806958ea8176e4c8494e3b3f79570635da (diff) | |
download | samba-501fa6a05db1b2c29b1e4720a03ed219aee2a346.tar.gz samba-501fa6a05db1b2c29b1e4720a03ed219aee2a346.tar.bz2 samba-501fa6a05db1b2c29b1e4720a03ed219aee2a346.zip |
Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/fsusage.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/util/fsusage.c b/lib/util/fsusage.c index 30f9f9c795..e5f2678a9f 100644 --- a/lib/util/fsusage.c +++ b/lib/util/fsusage.c @@ -19,7 +19,7 @@ #include "includes.h" #include "system/filesys.h" - + /** * @file * @brief Utility functions for getting the amount of free disk space @@ -30,12 +30,17 @@ */ static uint64_t adjust_blocks(uint64_t blocks, uint64_t fromsize, uint64_t tosize) { - if (fromsize == tosize) /* e.g., from 512 to 512 */ + if (fromsize == tosize) { /* e.g., from 512 to 512 */ return blocks; - else if (fromsize > tosize) /* e.g., from 2048 to 512 */ + } else if (fromsize > tosize) { /* e.g., from 2048 to 512 */ return blocks * (fromsize / tosize); - else /* e.g., from 256 to 512 */ + } else { /* e.g., from 256 to 512 */ + /* Protect against broken filesystems... */ + if (fromsize == 0) { + fromsize = tosize; + } return (blocks + 1) / (tosize / fromsize); + } } /** |