smbd: Slightly simplify smbd_smb2_lock_send()
authorVolker Lendecke <vl@samba.org>
Mon, 27 May 2019 15:03:38 +0000 (17:03 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 20 Jun 2019 17:18:18 +0000 (17:18 +0000)
For unlocking we don't need the error mapping, do an early return

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_lock.c

index e1df44bb3738d2ccd55b0e3d96ad06e72d5a3dd8..d2d8f0adf340c0b704b4b35cdc7d761504509593 100644 (file)
@@ -350,15 +350,17 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
        if (isunlock) {
                status = smbd_do_unlocking(
                        smb1req, fsp, in_lock_count, locks, WINDOWS_LOCK);
-               async = false;
-       } else {
-               status = smbd_do_locking(smb1req,
-                                        fsp,
-                                        timeout,
-                                        in_lock_count,
-                                        locks,
-                                        &async);
+
+               if (tevent_req_nterror(req, status)) {
+                       return tevent_req_post(req, ev);
+               }
+               tevent_req_done(req);
+               return tevent_req_post(req, ev);
        }
+
+       status = smbd_do_locking(
+               smb1req, fsp, timeout, in_lock_count, locks, &async);
+
        if (!NT_STATUS_IS_OK(status)) {
                if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) {
                       status = NT_STATUS_LOCK_NOT_GRANTED;