From: Ralph Boehme Date: Thu, 2 Jul 2020 12:08:44 +0000 (+0200) Subject: smbd: inverse if/else logic in get_lease_type() X-Git-Tag: samba-4.11.12~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc4f71046908be6f7694642acb71845defc79fb6;p=thirdparty%2Fsamba.git smbd: inverse if/else logic in get_lease_type() No change in behaviour. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher (backported from commit e4328db1c94837a8ea5652971cea20055d3d24ff) [slow@samba.org: take id from d as it's not passed as arg] --- diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index fe88adc9806..16484bb3d9d 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -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, - ¤t_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, + ¤t_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; } /****************************************************************************