diff options
author | Volker Lendecke <vl@samba.org> | 2009-04-05 06:33:24 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-04-06 21:32:07 +0200 |
commit | ad695b2525e192a75b54b614a17b662070c904ca (patch) | |
tree | aa4a1213fdeb4b55483198f1385545e4b26dd17a /source3 | |
parent | 097db28c5d2d1014ffe63430dbe6f944807faa5c (diff) | |
download | samba-ad695b2525e192a75b54b614a17b662070c904ca.tar.gz samba-ad695b2525e192a75b54b614a17b662070c904ca.tar.bz2 samba-ad695b2525e192a75b54b614a17b662070c904ca.zip |
Streamline cli_push sync wrapper
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clireadwrite.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 3b1af9e5a5..bb1e2f66c2 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -1216,32 +1216,41 @@ NTSTATUS cli_push(struct cli_state *cli, uint16_t fnum, uint16_t mode, TALLOC_CTX *frame = talloc_stackframe(); struct event_context *ev; struct async_req *req; - NTSTATUS result = NT_STATUS_NO_MEMORY; + NTSTATUS status = NT_STATUS_OK; - if (cli->fd_event != NULL) { + if (cli_has_async_calls(cli)) { /* * Can't use sync call while an async call is in flight */ - return NT_STATUS_INVALID_PARAMETER; + status = NT_STATUS_INVALID_PARAMETER; + goto fail; } ev = event_context_init(frame); if (ev == NULL) { - goto nomem; + status = NT_STATUS_NO_MEMORY; + goto fail; } req = cli_push_send(frame, ev, cli, fnum, mode, start_offset, window_size, source, priv); if (req == NULL) { - goto nomem; + status = NT_STATUS_NO_MEMORY; + goto fail; } while (req->state < ASYNC_REQ_DONE) { - event_loop_once(ev); + if (event_loop_once(ev) == -1) { + status = map_nt_error_from_unix(errno); + goto fail; + } } - result = cli_push_recv(req); - nomem: + status = cli_push_recv(req); + fail: TALLOC_FREE(frame); - return result; + if (!NT_STATUS_IS_OK(status)) { + cli_set_error(cli, status); + } + return status; } |