summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-01-04 16:26:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:54 -0500
commit2276cd666ff149f22b56971fb3015b903f5b3165 (patch)
tree53606a491607d360e9dbc43cad587cc2c2c06c99
parent3a9133dd0670391f7673c468e845dfae41064312 (diff)
downloadsamba-2276cd666ff149f22b56971fb3015b903f5b3165.tar.gz
samba-2276cd666ff149f22b56971fb3015b903f5b3165.tar.bz2
samba-2276cd666ff149f22b56971fb3015b903f5b3165.zip
r20525: Closing a dir with del-on-close set requires the same as files: Don't actually
unlink/rmdir if another process still has it open. Jeremy, this is a potential merger to 3.0.24. Volker (This used to be commit 8e1e896b02da99b5a48883c5f37fe146ad0fb5ce)
-rw-r--r--source3/smbd/close.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index bc2d6c3507..7e91208313 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -392,6 +392,18 @@ static int close_directory(files_struct *fsp, enum file_close_type close_type)
delete_dir = (lck->delete_on_close | lck->initial_delete_on_close);
+ if (delete_dir) {
+ int i;
+ /* See if others still have the dir open. If this is the
+ * case, then don't delete */
+ for (i=0; i<lck->num_share_modes; i++) {
+ if (is_valid_share_mode_entry(&lck->share_modes[i])) {
+ delete_dir = False;
+ break;
+ }
+ }
+ }
+
if ((close_type == NORMAL_CLOSE || close_type == SHUTDOWN_CLOSE) &&
delete_dir &&
lck->delete_token) {