smbd: inverse if/else logic in get_lease_type()
[amitay/samba.git] / source3 / smbd / oplock.c
index 2c4449b10b268ddb9d5bdfd7b5c33ca940fc9f09..c63f97aac0adfeeeb9fc99bca06c2b8491965b1d 100644 (file)
@@ -171,24 +171,24 @@ static void downgrade_file_oplock(files_struct *fsp)
 
 uint32_t get_lease_type(const struct share_mode_entry *e, struct file_id id)
 {
-       if (e->op_type == LEASE_OPLOCK) {
-               NTSTATUS status;
-               uint32_t current_state;
+       NTSTATUS status;
+       uint32_t current_state;
 
-               status = leases_db_get(
-                       &e->client_guid,
-                       &e->lease_key,
-                       &id,
-                       &current_state,
-                       NULL,   /* breaking */
-                       NULL,   /* breaking_to_requested */
-                       NULL,   /* breaking_to_required */
-                       NULL,   /* lease_version */
-                       NULL);  /* epoch */
-               SMB_ASSERT(NT_STATUS_IS_OK(status));
-               return current_state;
-       }
-       return map_oplock_to_lease_type(e->op_type);
+       if (e->op_type != LEASE_OPLOCK) {
+               return map_oplock_to_lease_type(e->op_type);
+       }
+
+       status = leases_db_get(&e->client_guid,
+                              &e->lease_key,
+                              &id,
+                              &current_state,
+                              NULL,    /* breaking */
+                              NULL,    /* breaking_to_requested */
+                              NULL,    /* breaking_to_required */
+                              NULL,    /* lease_version */
+                              NULL);   /* epoch */
+       SMB_ASSERT(NT_STATUS_IS_OK(status));
+       return current_state;
 }
 
 /****************************************************************************