diff options
author | Jeremy Allison <jra@samba.org> | 1997-10-08 20:34:13 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1997-10-08 20:34:13 +0000 |
commit | 74113cd60ecceaf73fce83e84dbcd58b498f2cb1 (patch) | |
tree | f254fd321dfa5b2ec9d07e26897e8f9a8b2bff4f /source3/smbd/server.c | |
parent | b2707324245d7143f4ac0056526044aed3881f3e (diff) | |
download | samba-74113cd60ecceaf73fce83e84dbcd58b498f2cb1.tar.gz samba-74113cd60ecceaf73fce83e84dbcd58b498f2cb1.tar.bz2 samba-74113cd60ecceaf73fce83e84dbcd58b498f2cb1.zip |
Makefile: Split definitions for SGI4,5,6.
includes.h: Split definitions for SGI4,5,6.
pipes.c: Moved Luke's #ifdef to remove warnings.
quotas.c: Two changes for FreeBSD and SGI.
server.c: Quota changes for large filesystems.
Jeremy (jallison@whistle.com)
(This used to be commit b8ff5543b9fa45095caa9f24aeb22a1dcc1cd308)
Diffstat (limited to 'source3/smbd/server.c')
-rw-r--r-- | source3/smbd/server.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 290181fb9e..2b906a7641 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -711,7 +711,15 @@ int disk_free(char *path,int *bsize,int *dfree,int *dsize) dfree_retval : dfreeq_retval ; /* maybe dfree and dfreeq are calculated using different bsizes so convert dfree from bsize into bsizeq */ - *dfree = ((*dfree) * (*bsize)) / (bsizeq); + /* avoid overflows due to multiplication, so do not: + *dfree = ((*dfree) * (*bsize)) / (bsizeq); + bsize and bsizeq are powers of 2 so its better to + to divide them getting a multiplication or division factor + for dfree. Rene Nieuwenhuizen (07-10-1997) */ + if (*bsize >= bsizeq) + *dfree = *dfree * (*bsize / bsizeq); + else + *dfree = *dfree / (bsizeq / *bsize); *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ; *bsize = bsizeq; *dsize = dsizeq; @@ -801,7 +809,15 @@ if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024; dfree_retval : dfreeq_retval ; /* maybe dfree and dfreeq are calculated using different bsizes so convert dfree from bsize into bsizeq */ - *dfree = ((*dfree) * (*bsize)) / (bsizeq); + /* avoid overflows due to multiplication, so do not: + *dfree = ((*dfree) * (*bsize)) / (bsizeq); + bsize and bsizeq are powers of 2 so its better to + to divide them getting a multiplication or division factor + for dfree. Rene Nieuwenhuizen (07-10-1997) */ + if (*bsize >= bsizeq) + *dfree = *dfree * (*bsize / bsizeq); + else + *dfree = *dfree / (bsizeq / *bsize); *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ; *bsize = bsizeq; *dsize = dsizeq; |