summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/vfs-wrap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index 50cf42e248..15d9572d1d 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -486,7 +486,7 @@ static int strict_allocate_ftruncate(files_struct *fsp, int fd, SMB_OFF_T len)
SMB_STRUCT_STAT st;
SMB_OFF_T currpos = vfs_ops->lseek(fsp, fd, 0, SEEK_CUR);
unsigned char zero_space[4096];
- SMB_OFF_T space_to_write = len - st.st_size;
+ SMB_OFF_T space_to_write;
if (currpos == -1)
return -1;
@@ -494,6 +494,8 @@ static int strict_allocate_ftruncate(files_struct *fsp, int fd, SMB_OFF_T len)
if (vfs_ops->fstat(fsp, fd, &st) == -1)
return -1;
+ space_to_write = len - st.st_size;
+
#ifdef S_ISFIFO
if (S_ISFIFO(st.st_mode))
return 0;