[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3300-gb995677

Jeremy Allison jra at samba.org
Thu Dec 25 20:14:19 GMT 2008


The branch, v3-2-test has been updated
       via  b995677f9895ba7fa9744b079ebc905713e59d40 (commit)
      from  7adf6961bfbbb3de07d40f397db5b5520d5f9d9f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit b995677f9895ba7fa9744b079ebc905713e59d40
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Dec 25 12:14:44 2008 -0800

    Fix bug #5990 - strict allocate should be checked before ftruncate
    reported by and based on a patch by Yasuma Takeda <yasuma at osstech.co.jp>.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/modules/vfs_default.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/modules/vfs_default.c b/source/modules/vfs_default.c
index 88c7237..2da97f1 100644
--- a/source/modules/vfs_default.c
+++ b/source/modules/vfs_default.c
@@ -714,6 +714,20 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs
 	if (st.st_size > len)
 		return sys_ftruncate(fsp->fh->fd, len);
 
+	/* available disk space is enough or not? */
+	if (lp_strict_allocate(SNUM(fsp->conn))){
+		SMB_BIG_UINT space_avail;
+		SMB_BIG_UINT bsize,dfree,dsize;
+
+		space_avail = get_dfree_info(fsp->conn,fsp->fsp_name,false,&bsize,&dfree,&dsize);
+		/* space_avail is 1k blocks */
+		if (space_avail == (SMB_BIG_UINT)-1 ||
+				((SMB_BIG_UINT)space_to_write/1024 > space_avail) ) {
+			errno = ENOSPC;
+			return -1;
+		}
+	}
+
 	/* Write out the real space on disk. */
 	if (SMB_VFS_LSEEK(fsp, st.st_size, SEEK_SET) != st.st_size)
 		return -1;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list