smbd: inverse if/else logic in get_lease_type()
authorRalph Boehme <slow@samba.org>
Thu, 2 Jul 2020 12:08:44 +0000 (14:08 +0200)
committerKarolin Seeger <kseeger@samba.org>
Thu, 6 Aug 2020 12:18:21 +0000 (12:18 +0000)
No change in behaviour.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(backported from commit e4328db1c94837a8ea5652971cea20055d3d24ff)
[slow@samba.org: take id from d as it's not passed as arg]

source3/smbd/oplock.c

index fe88adc980699aa88e72f79fa34f4c008427345f..16484bb3d9d510eef97225452a85572e0ad94c57 100644 (file)
@@ -175,24 +175,24 @@ static void downgrade_file_oplock(files_struct *fsp)
 uint32_t get_lease_type(const struct share_mode_data *d,
                        const struct share_mode_entry *e)
 {
-       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,
-                       &d->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,
+                              &d->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;
 }
 
 /****************************************************************************