[SCM] Samba Shared Repository - branch master updated - 5184baa9591640c7fac4574bad6c15f5c7302a87

Jeremy Allison jra at samba.org
Thu Dec 25 20:12:38 GMT 2008


The branch, master has been updated
       via  5184baa9591640c7fac4574bad6c15f5c7302a87 (commit)
      from  45db33e73262d8e195a46fb96405dfb3dc43d6bc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5184baa9591640c7fac4574bad6c15f5c7302a87
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Dec 25 12:13:12 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:
 source3/modules/vfs_default.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 8fa8f6a..d7f3922 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -740,6 +740,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))){
+		uint64_t space_avail;
+		uint64_t bsize,dfree,dsize;
+
+		space_avail = get_dfree_info(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