]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
authorJeremy Allison <jra@samba.org>
Tue, 28 Apr 2015 21:22:42 +0000 (14:22 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 6 May 2015 18:25:15 +0000 (20:25 +0200)
https://bugzilla.samba.org/show_bug.cgi?id=11240

Signed-off-by: Kenny Dinh <kdinh@peaxy.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
(cherry picked from commit d68383e9638254d1b6805b3d3ea3e5e897908374)

source3/modules/vfs_default.c

index 23c1cc2a00cb42ed384337829f44103801f287e7..618e460491236d40bc6dcfce5bd5eb6c03ed6050 100644 (file)
@@ -1870,8 +1870,6 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t
           ftruncate extend but ext2 can. */
 
        result = ftruncate(fsp->fh->fd, len);
-       if (result == 0)
-               goto done;
 
        /* According to W. R. Stevens advanced UNIX prog. Pure 4.3 BSD cannot
           extend a file with ftruncate. Provide alternate implementation
@@ -1885,6 +1883,12 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
+
+       /* We need to update the files_struct after successful ftruncate */
+       if (result == 0) {
+               goto done;
+       }
+
        pst = &fsp->fsp_name->st;
 
 #ifdef S_ISFIFO