summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-11 19:14:27 +0000
committerJeremy Allison <jra@samba.org>1998-09-11 19:14:27 +0000
commit27d0bef143fbc4d7547c022046c094bbdbd0bfc1 (patch)
tree884cadd16fda29312e86a9d19b2bfb1562ff7530 /source3/smbd/close.c
parent06cc91f9a631a23dcd4902d710b89e4b7584c459 (diff)
downloadsamba-27d0bef143fbc4d7547c022046c094bbdbd0bfc1.tar.gz
samba-27d0bef143fbc4d7547c022046c094bbdbd0bfc1.tar.bz2
samba-27d0bef143fbc4d7547c022046c094bbdbd0bfc1.zip
Ok - this is the 'expose 64 bit to the clients' checkin.
I have tested it by creating a 'holey' 20GB file - checking that it shows up correctl in the NT file view (it does) and am busily copying it to NULL: on the NT box. All good so far.... :-). Also implemented NT 'delete on close' semantics. Jeremy. (This used to be commit 1654faee80648583e6a47ab7eda990fefdf85124)
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index e9606cdfbe..981c0d77bb 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -102,6 +102,7 @@ void close_file(files_struct *fsp, BOOL normal_close)
SMB_DEV_T dev = fsp->fd_ptr->dev;
SMB_INO_T inode = fsp->fd_ptr->inode;
int token;
+ BOOL last_reference = False;
connection_struct *conn = fsp->conn;
remove_pending_lock_requests_by_fid(fsp);
@@ -118,7 +119,9 @@ void close_file(files_struct *fsp, BOOL normal_close)
}
if(fd_attempt_close(fsp->fd_ptr) == 0)
- fsp->fd_ptr = NULL;
+ last_reference = True;
+
+ fsp->fd_ptr = NULL;
if (lp_share_modes(SNUM(conn)))
unlock_share_entry(conn, dev, inode, token);
@@ -132,6 +135,17 @@ void close_file(files_struct *fsp, BOOL normal_close)
check_magic(fsp,conn);
}
+ /*
+ * NT can set delete_on_close of the last open
+ * reference to a file.
+ */
+
+ if (normal_close && last_reference && fsp->delete_on_close) {
+ if(dos_unlink(fsp->fsp_name) != 0)
+ DEBUG(0,("close_file: file %s. Delete on close was set and unlink failed \
+with error %s\n", fsp->fsp_name, strerror(errno) ));
+ }
+
if(fsp->granted_oplock == True)
global_oplocks_open--;