summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_commit.c11
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;