s3: Slightly simplify close_remove_share_mode
[kai/samba.git] / source3 / smbd / close.c
index 3045990b9806122d960e1aa4cad15af89ddffacf..e2d7c2c7a7b2ac4230c836ec9d629ee3d177ee0c 100644 (file)
@@ -421,17 +421,22 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
                   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_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
-                                       continue;
-                               }
-                               if (share_mode_stale_pid(lck->data, i)) {
-                                       continue;
-                               }
-                               delete_file = False;
-                               break;
+
+                       if (!is_valid_share_mode_entry(e)) {
+                               continue;
                        }
+                       if (e->name_hash != fsp->name_hash) {
+                               continue;
+                       }
+                       if (fsp->posix_open
+                           && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
+                               continue;
+                       }
+                       if (share_mode_stale_pid(lck->data, i)) {
+                               continue;
+                       }
+                       delete_file = False;
+                       break;
                }
        }