smbd: Simplify close_directory()
authorVolker Lendecke <vl@samba.org>
Sat, 8 Sep 2018 11:44:30 +0000 (13:44 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 11 Sep 2018 16:36:23 +0000 (18:36 +0200)
Same patch as in 8541829a9ab20c7fa8c

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/close.c

index 7820fff3519d436db99600db25f4341bac66b381..288415a21b2922c35133367d3452a33f2eb90c63 100644 (file)
@@ -1153,23 +1153,27 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
                 * case, then don't delete. If all opens are POSIX delete now. */
                for (i=0; i<lck->data->num_share_modes; i++) {
                        struct share_mode_entry *e = &lck->data->share_modes[i];
-                       if (is_valid_share_mode_entry(e) &&
-                                       e->name_hash == fsp->name_hash) {
-                               if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) &&
-                                   (e->flags & SHARE_MODE_FLAG_POSIX_OPEN))
-                               {
-                                       continue;
-                               }
-                               if (serverid_equal(&self, &e->pid) &&
-                                   (e->share_file_id == fsp->fh->gen_id)) {
-                                       continue;
-                               }
-                               if (share_mode_stale_pid(lck->data, i)) {
-                                       continue;
-                               }
-                               delete_dir = False;
-                               break;
+
+                       if (!is_valid_share_mode_entry(e)) {
+                               continue;
+                       }
+                       if (e->name_hash != fsp->name_hash) {
+                               continue;
                        }
+                       if ((fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) &&
+                           (e->flags & SHARE_MODE_FLAG_POSIX_OPEN))
+                       {
+                               continue;
+                       }
+                       if (serverid_equal(&self, &e->pid) &&
+                           (e->share_file_id == fsp->fh->gen_id)) {
+                               continue;
+                       }
+                       if (share_mode_stale_pid(lck->data, i)) {
+                               continue;
+                       }
+                       delete_dir = False;
+                       break;
                }
        }