summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-10-23 17:25:14 +0000
committerJeremy Allison <jra@samba.org>1998-10-23 17:25:14 +0000
commit6d99f5f339b572df1cd737286fbb64ad23f74fc7 (patch)
tree04cb738b2cad1f8140e88208414b7f65f1892cab /source3/smbd/close.c
parenta9d1a8996324cd5344bc5579c4556632c59ef3e2 (diff)
downloadsamba-6d99f5f339b572df1cd737286fbb64ad23f74fc7.tar.gz
samba-6d99f5f339b572df1cd737286fbb64ad23f74fc7.tar.bz2
samba-6d99f5f339b572df1cd737286fbb64ad23f74fc7.zip
Handle the case where multiple smbd have the file open, some of whom
don't have the ALLOW_DELETE_ON_CLOSE share flag enabled. Told you this was fiddly code :-). Jeremy. (This used to be commit 222d686a6cdbc2947e7201636ae80ef4c650a65d)
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 50ad01f575..fcb65e1331 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -143,9 +143,18 @@ void close_file(files_struct *fsp, BOOL normal_close)
if (normal_close && last_reference && delete_on_close) {
DEBUG(5,("close_file: file %s. Delete on close was set - deleting file.\n"));
- if(dos_unlink(fsp->fsp_name) != 0)
- DEBUG(0,("close_file: file %s. Delete on close was set and unlink failed \
+ if(dos_unlink(fsp->fsp_name) != 0) {
+
+ /*
+ * This call can potentially fail as another smbd may have
+ * had the file open with delete on close set and deleted
+ * it when its last reference to this file went away. Hence
+ * we log this but not at debug level zero.
+ */
+
+ DEBUG(5,("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)