From 05379f01252fc8b449f36130bcf00c321d7a1c37 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Thu, 14 May 2009 10:13:12 +0800 Subject: s3: return proper error code in cli_smb_req_send Signed-off-by: Bo Yang --- source3/libsmb/clifile.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/libsmb/clifile.c') diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 63e6c474db..3c13383669 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1484,13 +1484,19 @@ struct tevent_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev, int flags, int share_mode) { struct tevent_req *req, *subreq; + NTSTATUS status; req = cli_open_create(mem_ctx, ev, cli, fname, flags, share_mode, &subreq); - if ((req == NULL) || !cli_smb_req_send(subreq)) { - TALLOC_FREE(req); + if (req == NULL) { return NULL; } + + status = cli_smb_req_send(subreq); + if (!NT_STATUS_IS_OK(status)) { + tevent_req_nterror(req, status); + return tevent_req_post(req, ev); + } return req; } @@ -1612,12 +1618,18 @@ struct tevent_req *cli_close_send(TALLOC_CTX *mem_ctx, uint16_t fnum) { struct tevent_req *req, *subreq; + NTSTATUS status; req = cli_close_create(mem_ctx, ev, cli, fnum, &subreq); - if ((req == NULL) || !cli_smb_req_send(subreq)) { - TALLOC_FREE(req); + if (req == NULL) { return NULL; } + + status = cli_smb_req_send(subreq); + if (!NT_STATUS_IS_OK(status)) { + tevent_req_nterror(req, status); + return tevent_req_post(req, ev); + } return req; } -- cgit