From 9108572039e42fbc0ec540d8a89764d81597dd5d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 26 Jul 2018 15:46:18 +0200 Subject: [PATCH] smbd: Simplify logic in fsp_lease_update One if-condition is better than two Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/smbd/oplock.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index a23b87769e2..8073fbe3dca 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -400,11 +400,7 @@ bool fsp_lease_update(struct share_mode_lock *lck, struct share_mode_lease *l = NULL; idx = find_share_mode_lease(d, client_guid, &lease->lease.lease_key); - if (idx != -1) { - l = &d->leases[idx]; - } - - if (l == NULL) { + if (idx == -1) { DEBUG(1, ("%s: Could not find lease entry\n", __func__)); TALLOC_FREE(lease->timeout); lease->lease.lease_state = SMB2_LEASE_NONE; @@ -413,6 +409,8 @@ bool fsp_lease_update(struct share_mode_lock *lck, return false; } + l = &d->leases[idx]; + DEBUG(10,("%s: refresh lease state\n", __func__)); /* Ensure we're in sync with current lease state. */ -- 2.47.2