fix for bug 564: filesizes are incorrectly displayed in Mac OS X

Jeremy Allison jra at samba.org
Sun Oct 5 07:26:16 GMT 2003


On Sat, Oct 04, 2003 at 06:15:13PM -0700, Nicholas M. Kirsch wrote:
> --- trans2.c.orig	Thu Oct  2 17:40:45 2003
> +++ trans2.c	Sat Oct  4 18:04:46 2003
> @@ -1407,9 +1407,24 @@
>  	switch (info_level) {
>  		case SMB_INFO_ALLOCATION:
>  		{
> -			SMB_BIG_UINT dfree,dsize,bsize;
> +			SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
>  			data_len = 18;
>  			SMB_VFS_DISK_FREE(conn,".",False,&bsize,&dfree,&dsize);	
> +			block_size = lp_block_size(snum);
> +			if (bsize < block_size) {
> +				SMB_BIG_UINT factor = block_size/bsize;
> +				bsize = block_size;
> +				dsize /= factor;
> +				dfree /= factor;
> +			}
> +			if (bsize > block_size) {
> +				SMB_BIG_UINT factor = bsize/block_size;
> +				bsize = block_size;
> +				dsize *= factor;
> +				dfree *= factor;
> +			}
> +			bytes_per_sector = 512;
> +			sectors_per_unit = bsize/bytes_per_sector;
>  			SIVAL(pdata,l1_idFileSystem,st.st_dev);
>  			SIVAL(pdata,l1_cSectorUnit,bsize/512);
>  			SIVAL(pdata,l1_cUnit,dsize);

Team - please don't anyone apply this until I've taken a good long
look at this. There are reasons the current allocation code is the
way it is.....

Jeremy.



More information about the samba-technical mailing list