svn commit: samba r7452 - in branches/SAMBA_3_0/source/smbd: .

jra at samba.org jra at samba.org
Fri Jun 10 00:32:00 GMT 2005


Author: jra
Date: 2005-06-10 00:31:59 +0000 (Fri, 10 Jun 2005)
New Revision: 7452

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7452

Log:
Set sparse flag if needed. Based on code from jpeach at sgi.com.
Fixes bug #2774.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/dosmode.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/dosmode.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/dosmode.c	2005-06-09 19:59:42 UTC (rev 7451)
+++ branches/SAMBA_3_0/source/smbd/dosmode.c	2005-06-10 00:31:59 UTC (rev 7452)
@@ -20,6 +20,16 @@
 
 #include "includes.h"
 
+static int set_sparse_flag(const SMB_STRUCT_STAT * const sbuf)
+{
+#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
+	if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)STAT_ST_BLOCKSIZE) {
+		return FILE_ATTRIBUTE_SPARSE;
+	}
+#endif
+	return 0;
+}
+
 /****************************************************************************
  Change a dos mode to a unix mode.
     Base permission for files:
@@ -140,11 +150,7 @@
 	if (S_ISDIR(sbuf->st_mode))
 		result = aDIR | (result & aRONLY);
 
-#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
-	if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)STAT_ST_BLOCKSIZE) {
-		result |= FILE_ATTRIBUTE_SPARSE;
-	}
-#endif
+	result |= set_sparse_flag(sbuf);
  
 #ifdef S_ISLNK
 #if LINKS_READ_ONLY
@@ -293,6 +299,7 @@
 
 	/* Get the DOS attributes from an EA by preference. */
 	if (get_ea_dos_attribute(conn, path, sbuf, &result)) {
+		result |= set_sparse_flag(sbuf);
 		return result;
 	}
 



More information about the samba-cvs mailing list