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

Nicholas M. Kirsch nick at isilon.com
Sun Oct 5 01:15:13 GMT 2003


--- 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);
-- 
Nicholas Kirsch
Applications Developer

Isilon Systems     | Intelligent Storage for Digital Content
220 W. Mercer St.  | Suite 501 | Seattle, WA 98119
E: nick at isilon.com | T: 206.315.7555
W:  www.isilon.com | Fax: 206.315.7501



More information about the samba-technical mailing list