diff options
author | Uri Simchoni <uri@samba.org> | 2015-10-07 22:44:11 +0300 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2015-10-13 09:23:24 +0200 |
commit | b6bdeb8bf9a69e8cb5a334cfdf8c41ef461941ab (patch) | |
tree | 5fc688c0c20e3ba3ed6bbfc63785dc4cc2de835a /source3 | |
parent | 5dceb51442b65d72dd948394e653dedc572a6f38 (diff) | |
download | samba-b6bdeb8bf9a69e8cb5a334cfdf8c41ef461941ab.tar.gz |
vfs_commit: set the fd on open before calling SMB_VFS_FSTAT
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11547
Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 8 02:56:41 CEST 2015 on sn-devel-104
(cherry picked from commit 5709dece4860f205e31309e31ec4e3e938d9f6a5)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/modules/vfs_commit.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index a6bc2a4a656..f1e2743b036 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -230,7 +230,16 @@ static int commit_open( /* EOF commit modes require us to know the initial file size. */ if (c && (c->on_eof != EOF_NONE)) { SMB_STRUCT_STAT st; - if (SMB_VFS_FSTAT(fsp, &st) == -1) { + /* + * Setting the fd of the FSP is a hack + * but also practiced elsewhere - + * needed for calling the VFS. + */ + fsp->fh->fd = fd; + if (SMB_VFS_FSTAT(fsp, &st) == -1) { + int saved_errno = errno; + SMB_VFS_CLOSE(fsp); + errno = saved_errno; return -1; } c->eof = st.st_ex_size; |