Correct sync wrappers in cli_pipe.c
authorVolker Lendecke <vl@samba.org>
Mon, 6 Apr 2009 18:52:04 +0000 (20:52 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 6 Apr 2009 19:32:08 +0000 (21:32 +0200)
source3/rpc_client/cli_pipe.c

index 6b83c170f5791d06097c2d0671dbbc8651fa30ee..a8cc33f585e976729b3029e39c9bac03ce508253 100644 (file)
@@ -2291,19 +2291,24 @@ NTSTATUS rpc_api_pipe_req(TALLOC_CTX *mem_ctx, struct rpc_pipe_client *cli,
        TALLOC_CTX *frame = talloc_stackframe();
        struct event_context *ev;
        struct tevent_req *req;
-       NTSTATUS status = NT_STATUS_NO_MEMORY;
+       NTSTATUS status = NT_STATUS_OK;
 
        ev = event_context_init(frame);
        if (ev == NULL) {
+               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
        req = rpc_api_pipe_req_send(frame, ev, cli, op_num, in_data);
        if (req == NULL) {
+               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
-       tevent_req_poll(req, ev);
+       if (!tevent_req_poll(req, ev)) {
+               status = map_nt_error_from_unix(errno);
+               goto fail;
+       }
 
        status = rpc_api_pipe_req_recv(req, mem_ctx, out_data);
  fail:
@@ -2905,19 +2910,24 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
        TALLOC_CTX *frame = talloc_stackframe();
        struct event_context *ev;
        struct tevent_req *req;
-       NTSTATUS status = NT_STATUS_NO_MEMORY;
+       NTSTATUS status = NT_STATUS_OK;
 
        ev = event_context_init(frame);
        if (ev == NULL) {
+               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
        req = rpc_pipe_bind_send(frame, ev, cli, auth);
        if (req == NULL) {
+               status = NT_STATUS_NO_MEMORY;
                goto fail;
        }
 
-       tevent_req_poll(req, ev);
+       if (!tevent_req_poll(req, ev)) {
+               status = map_nt_error_from_unix(errno);
+               goto fail;
+       }
 
        status = rpc_pipe_bind_recv(req);
  fail: