summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-11-21 12:14:53 -0800
committerJeremy Allison <jra@samba.org>2008-11-21 12:14:53 -0800
commit97fb05c2c0d0b08f3ed5aa7358a4d6d8c1725012 (patch)
treeab3142c02ae83f60cd92f2717d567f36612d918c /source3/smbd/close.c
parent9164b14a9fb1fee9ddec275032bb911d34b683d5 (diff)
downloadsamba-97fb05c2c0d0b08f3ed5aa7358a4d6d8c1725012.tar.gz
samba-97fb05c2c0d0b08f3ed5aa7358a4d6d8c1725012.tar.bz2
samba-97fb05c2c0d0b08f3ed5aa7358a4d6d8c1725012.zip
First part of fix for bug #5903 - vfs_streams_xattr breaks contents of the file.
Restructures parts of open code so that fsp must be allocated before calling open_file_ntcreate(_internal). Also fix up file ref-counting inside files.c. Jeremy.
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index d4c531ab19..ce918ab6a3 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -106,8 +106,7 @@ static void check_magic(struct files_struct *fsp)
static NTSTATUS close_filestruct(files_struct *fsp)
{
NTSTATUS status = NT_STATUS_OK;
- connection_struct *conn = fsp->conn;
-
+
if (fsp->fh->fd != -1) {
if(flush_write_cache(fsp, CLOSE_FLUSH) == -1) {
status = map_nt_error_from_unix(errno);
@@ -115,9 +114,8 @@ static NTSTATUS close_filestruct(files_struct *fsp)
delete_write_cache(fsp);
}
- conn->num_files_open--;
return status;
-}
+}
/****************************************************************************
If any deferred opens are waiting on this close, notify them.
@@ -583,7 +581,7 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
DEBUG(2,("%s closed file %s (numopen=%d) %s\n",
conn->server_info->unix_name,fsp->fsp_name,
- conn->num_files_open,
+ conn->num_files_open - 1,
nt_errstr(status) ));
file_free(req, fsp);