r20525: Closing a dir with del-on-close set requires the same as files: Don't actually
authorVolker Lendecke <vlendec@samba.org>
Thu, 4 Jan 2007 16:26:15 +0000 (16:26 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:54 +0000 (12:16 -0500)
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)

source3/smbd/close.c

index bc2d6c3507ad6ddaecd18c05e41dd74188348e54..7e912083137ad62fc84d7c44a0161d4f854116b5 100644 (file)
@@ -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) {