]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Save a few lines by using tevent_req_nterror()'s retval
authorVolker Lendecke <vl@samba.org>
Thu, 1 Sep 2022 10:30:57 +0000 (12:30 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 7 Sep 2022 18:40:28 +0000 (18:40 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_aio.c
source3/smbd/smb2_create.c
source3/smbd/smb2_ioctl_filesys.c
source3/smbd/smb2_notify.c
source3/smbd/smb2_query_directory.c
source3/smbd/smb2_sesssetup.c

index eeddb27a073776ef7870ac896175f353eb264685..76a5b644ef8671c7934de511f13c82deb6270ae9 100644 (file)
@@ -411,8 +411,7 @@ static void aio_pread_smb2_done(struct tevent_req *req)
                   (unsigned int)nread,
                   vfs_aio_state.error, nt_errstr(status)));
 
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(subreq, status);
+       if (tevent_req_nterror(subreq, status)) {
                return;
        }
        tevent_req_done(subreq);
@@ -560,8 +559,7 @@ static void aio_pwrite_smb2_done(struct tevent_req *req)
                   (unsigned int)nwritten,
                   err, nt_errstr(status)));
 
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(subreq, status);
+       if (tevent_req_nterror(subreq, status)) {
                return;
        }
        tevent_req_done(subreq);
index 4865af4b86271b636e7c1b107687b15801984138..34dd338a4a0b18f61ee2adf89f00ed02f41992a9 100644 (file)
@@ -806,8 +806,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                }
 
                status = open_np_file(smb1req, pipe_name, &state->result);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, state->ev);
                }
                state->info = FILE_WAS_OPENED;
@@ -824,16 +823,14 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                }
 
                status = file_new(smb1req, smb1req->conn, &state->result);
-               if(!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, state->ev);
                }
 
                status = print_spool_open(state->result, in_name,
                                          smb1req->vuid);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (tevent_req_nterror(req, status)) {
                        file_free(smb1req, state->result);
-                       tevent_req_nterror(req, status);
                        return tevent_req_post(req, state->ev);
                }
                state->info = FILE_WAS_CREATED;
@@ -844,8 +841,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
        /* Check for trailing slash specific directory handling. */
        status = windows_name_trailing_check(state->fname, in_create_options);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, state->ev);
        }
 
@@ -887,10 +883,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                                               state->create_guid,
                                               now,
                                               &state->op);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (tevent_req_nterror(req, status)) {
                        DBG_NOTICE("smb2srv_open_recreate failed: %s\n",
                                   nt_errstr(status));
-                       tevent_req_nterror(req, status);
                        return tevent_req_post(req, state->ev);
                }
 
@@ -929,10 +924,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
                status = smbd_smb2_create_durable_lease_check(
                        smb1req, state->fname, state->result, state->lease_ptr);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (tevent_req_nterror(req, status)) {
                        close_file_free(
                                smb1req, &state->result, SHUTDOWN_CLOSE);
-                       tevent_req_nterror(req, status);
                        return tevent_req_post(req, state->ev);
                }
 
@@ -970,8 +964,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
        /* convert '\\' into '/' */
        status = check_path_syntax_smb2(state->fname, is_dfs);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, state->ev);
        }
 
@@ -986,8 +979,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                state->twrp_time,
                &dirfsp,
                &smb_fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, state->ev);
        }
 
@@ -1266,10 +1258,9 @@ static void smbd_smb2_create_before_exec(struct tevent_req *req)
                } else if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_NOT_AVAILABLE)) {
                        tevent_req_nterror(req, status);
                        return;
-               } else if (!NT_STATUS_IS_OK(status)) {
+               } else if (tevent_req_nterror(req, status)) {
                        DBG_WARNING("smb2srv_open_lookup_replay_cache "
                                    "failed: %s\n", nt_errstr(status));
-                       tevent_req_nterror(req, status);
                        return;
                } else if (!state->replay_operation) {
                        /*
@@ -1438,8 +1429,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                                state->out_context_blobs,
                                SMB2_CREATE_TAG_MXAC,
                                blob);
-                       if (!NT_STATUS_IS_OK(status)) {
-                               tevent_req_nterror(req, status);
+                       if (tevent_req_nterror(req, status)) {
                                tevent_req_post(req, state->ev);
                                return;
                        }
@@ -1475,8 +1465,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                DEBUG(10, ("smb2_create_send: smbXsrv_open_update "
                           "returned %s\n",
                           nt_errstr(status)));
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_post(req, state->ev);
                        return;
                }
@@ -1496,8 +1485,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                                              state->out_context_blobs,
                                              SMB2_CREATE_TAG_DHNQ,
                                              blob);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_post(req, state->ev);
                        return;
                }
@@ -1526,8 +1514,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                                              state->out_context_blobs,
                                              SMB2_CREATE_TAG_DH2Q,
                                              blob);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_post(req, state->ev);
                        return;
                }
@@ -1554,8 +1541,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                                              state->out_context_blobs,
                                              SMB2_CREATE_TAG_QFID,
                                              blob);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_post(req, state->ev);
                        return;
                }
@@ -1584,8 +1570,7 @@ static void smbd_smb2_create_after_exec(struct tevent_req *req)
                        state, state->out_context_blobs,
                        SMB2_CREATE_TAG_RQLS,
                        data_blob_const(buf, lease_len));
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        tevent_req_post(req, state->ev);
                        return;
                }
index fe24fca518d55fad2ab3a68b5b98a0288e0c2ee9..36429b8fd352206d9263400185cc82965af07a9c 100644 (file)
@@ -213,8 +213,7 @@ static struct tevent_req *fsctl_dup_extents_send(TALLOC_CTX *mem_ctx,
 
        status = fsctl_dup_extents_check_lengths(src_fsp, dst_fsp,
                                                 &state->dup_extents);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }
 
@@ -226,14 +225,12 @@ static struct tevent_req *fsctl_dup_extents_send(TALLOC_CTX *mem_ctx,
 
        status = fsctl_dup_extents_check_overlap(src_fsp, dst_fsp,
                                                 &state->dup_extents);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }
 
        status = fsctl_dup_extents_check_sparse(src_fsp, dst_fsp);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }
 
index 75e591d133241d1c78c89093a86aa359192ebc52..133c990f0df910e41041ec27493e53779dd2350e 100644 (file)
@@ -266,10 +266,9 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx,
                                              in_output_buffer_length,
                                              in_completion_filter,
                                              recursive);
-               if (!NT_STATUS_IS_OK(status)) {
+               if (tevent_req_nterror(req, status)) {
                        DEBUG(10, ("change_notify_create returned %s\n",
                                   nt_errstr(status)));
-                       tevent_req_nterror(req, status);
                        return tevent_req_post(req, ev);
                }
        }
@@ -307,8 +306,7 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx,
                        in_completion_filter,
                        recursive, fsp,
                        smbd_smb2_notify_reply);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }
 
@@ -358,8 +356,7 @@ static void smbd_smb2_notify_reply(struct smb_request *smbreq,
 
        tevent_req_defer_callback(req, state->smb2req->sconn->ev_ctx);
 
-       if (!NT_STATUS_IS_OK(state->status)) {
-               tevent_req_nterror(req, state->status);
+       if (tevent_req_nterror(req, state->status)) {
                return;
        }
 
index 81487a4d997f34f1a85c3828e12f9c74bb7f72a4..9b06bd4a12c61b3fe35541eaf4c7ed81fdbd53bb 100644 (file)
@@ -896,8 +896,7 @@ static void fetch_write_time_done(struct tevent_req *subreq)
                tevent_req_done(req);
                return;
        }
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
@@ -1008,8 +1007,7 @@ static void fetch_dos_mode_done(struct tevent_req *subreq)
                tevent_req_done(req);
                return;
        }
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return;
        }
 
index 14b806bc007dfa48ed919716546faac92fab6b3f..cd97f775eb5dff8db08749ee0ddcef1174f39ef4 100644 (file)
@@ -782,14 +782,12 @@ static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
                                                     smb2req->xconn,
                                                     now,
                                                     &c);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, ev);
                }
 
                status = smbXsrv_session_update(smb2req->session);
-               if (!NT_STATUS_IS_OK(status)) {
-                       tevent_req_nterror(req, status);
+               if (tevent_req_nterror(req, status)) {
                        return tevent_req_post(req, ev);
                }
        }
@@ -832,8 +830,7 @@ auth:
 
        status = smbXsrv_session_find_channel(smb2req->session,
                                              smb2req->xconn, &c);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
+       if (tevent_req_nterror(req, status)) {
                return tevent_req_post(req, ev);
        }