smbd: Simplify logic in fsp_lease_update
authorVolker Lendecke <vl@samba.org>
Thu, 26 Jul 2018 13:46:18 +0000 (15:46 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 7 Sep 2018 15:26:18 +0000 (17:26 +0200)
One if-condition is better than two

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/oplock.c

index a23b87769e2d914f2e0a9f1f19cd1da2d39d3078..8073fbe3dca2764c44477389bb12ea3f2763fc3a 100644 (file)
@@ -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. */