libsmb: Align cli_ntcreate with other sync wrappers
authorVolker Lendecke <vl@samba.org>
Fri, 20 Jun 2014 08:53:49 +0000 (08:53 +0000)
committerVolker Lendecke <vl@samba.org>
Sat, 21 Jun 2014 18:38:11 +0000 (20:38 +0200)
... saves 5 lines :-)

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

index c8a36104c29e006b74618c2c568fce3490506211..aee1745af4dc27b4b4f471314868f81c09001a16 100644 (file)
@@ -2015,12 +2015,10 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
                      uint16_t *pfid,
                      struct smb_create_returns *cr)
 {
-       TALLOC_CTX *frame = NULL;
+       TALLOC_CTX *frame = talloc_stackframe();
        struct tevent_context *ev;
        struct tevent_req *req;
-       NTSTATUS status = NT_STATUS_OK;
-
-       frame = talloc_stackframe();
+       NTSTATUS status = NT_STATUS_NO_MEMORY;
 
        if (smbXcli_conn_has_async_calls(cli->conn)) {
                /*
@@ -2032,7 +2030,6 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
 
        ev = samba_tevent_context_init(frame);
        if (ev == NULL) {
-               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
@@ -2041,12 +2038,10 @@ NTSTATUS cli_ntcreate(struct cli_state *cli,
                                CreateDisposition, CreateOptions,
                                SecurityFlags);
        if (req == NULL) {
-               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
-       if (!tevent_req_poll(req, ev)) {
-               status = map_nt_error_from_unix(errno);
+       if (!tevent_req_poll_ntstatus(req, ev, &status)) {
                goto fail;
        }