From: Volker Lendecke Date: Thu, 26 Jul 2018 12:52:55 +0000 (+0200) Subject: smbd: Simplify logic in smb2_lease_break_send X-Git-Tag: tdb-1.3.17~1686 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a7820141908084aaa002d3f4b8a984fcb67d2d9;p=thirdparty%2Fsamba.git smbd: Simplify logic in smb2_lease_break_send If/else if chains are hard to follow to me. Simplify the code by using early returns. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c index 21fbef42dce..ec9c0f1376b 100644 --- a/source3/smbd/smb2_break.c +++ b/source3/smbd/smb2_break.c @@ -386,14 +386,16 @@ static struct tevent_req *smbd_smb2_lease_break_send( status = NT_STATUS_OBJECT_NAME_NOT_FOUND; DEBUG(10, ("No record for lease key found\n")); } - } else if (!NT_STATUS_IS_OK(lls.status)) { - status = lls.status; - } else if (lls.num_file_ids == 0) { - status = NT_STATUS_OBJECT_NAME_NOT_FOUND; + tevent_req_nterror(req, status); + return tevent_req_post(req, ev); } - if (!NT_STATUS_IS_OK(status)) { - tevent_req_nterror(req, status); + if (tevent_req_nterror(req, lls.status)) { + return tevent_req_post(req, ev); + } + + if (lls.num_file_ids == 0) { + tevent_req_nterror(req, NT_STATUS_OBJECT_NAME_NOT_FOUND); return tevent_req_post(req, ev); }