summaryrefslogtreecommitdiff
path: root/source3/smbd/fileio.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-06-15 19:24:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:23 -0500
commitcc35d1300d487c65f1dc8a275140701ba276adaf (patch)
treeb60ade00d9273c5fc68c50dbb22974d4733ae85b /source3/smbd/fileio.c
parent43d59b7d420c3d3e67d98fabac2fe18403f75f4e (diff)
downloadsamba-cc35d1300d487c65f1dc8a275140701ba276adaf.tar.gz
samba-cc35d1300d487c65f1dc8a275140701ba276adaf.tar.bz2
samba-cc35d1300d487c65f1dc8a275140701ba276adaf.zip
r23508: Fix sync_file() to return NTSTATUS and return this
on failure in the write path. Jeremy. (This used to be commit cd3f7dbee809fb40194af0e7509142166e02b252)
Diffstat (limited to 'source3/smbd/fileio.c')
-rw-r--r--source3/smbd/fileio.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 65238c0e9e..1227d12b08 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -834,16 +834,23 @@ ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason)
sync a file
********************************************************************/
-void sync_file(connection_struct *conn, files_struct *fsp, BOOL write_through)
+NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, BOOL write_through)
{
if (fsp->fh->fd == -1)
- return;
+ return NT_STATUS_INVALID_HANDLE;
if (lp_strict_sync(SNUM(conn)) &&
(lp_syncalways(SNUM(conn)) || write_through)) {
- flush_write_cache(fsp, SYNC_FLUSH);
- SMB_VFS_FSYNC(fsp,fsp->fh->fd);
+ int ret = flush_write_cache(fsp, SYNC_FLUSH);
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ ret = SMB_VFS_FSYNC(fsp,fsp->fh->fd);
+ if (ret == -1) {
+ return map_nt_error_from_unix(errno);
+ }
}
+ return NT_STATUS_OK;
}
/************************************************************