summaryrefslogtreecommitdiffstats
path: root/source/lib/fsusage.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-08-04 05:42:36 +0000
committerGerald Carter <jerry@samba.org>2004-08-04 05:42:36 +0000
commitfecd5ea163ffcd1bbee5b06e05112dbff9aa71b1 (patch)
tree917402d02525c39dd42d3aed01609ac02be104b4 /source/lib/fsusage.c
parent7cc5217c98cab4d0d970a2eb7f378319bedb6a46 (diff)
downloadsamba-fecd5ea163ffcd1bbee5b06e05112dbff9aa71b1.tar.gz
samba-fecd5ea163ffcd1bbee5b06e05112dbff9aa71b1.tar.xz
samba-fecd5ea163ffcd1bbee5b06e05112dbff9aa71b1.zip
r1643: syncing all changes from 3.0 and hopefully get 3.0.6rc2 out tomorrow
Diffstat (limited to 'source/lib/fsusage.c')
-rw-r--r--source/lib/fsusage.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/lib/fsusage.c b/source/lib/fsusage.c
index bb7cff06453..036f276319f 100644
--- a/source/lib/fsusage.c
+++ b/source/lib/fsusage.c
@@ -26,12 +26,17 @@
*/
static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SMB_BIG_UINT 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);
+ }
}
/* this does all of the system specific guff to get the free disk space.