diff options
author | Volker Lendecke <vl@samba.org> | 2009-02-28 12:19:24 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-02-28 12:32:22 +0100 |
commit | ddd3da8ab7b82a59b84338fb4814981d5ae2f8e4 (patch) | |
tree | 09848c63d0429fea29f37666f851106033dcc6e8 | |
parent | 9569d979de43970399f33645323e9091338084f6 (diff) | |
download | samba-ddd3da8ab7b82a59b84338fb4814981d5ae2f8e4.tar.gz samba-ddd3da8ab7b82a59b84338fb4814981d5ae2f8e4.tar.bz2 samba-ddd3da8ab7b82a59b84338fb4814981d5ae2f8e4.zip |
Simplify async_connect_send slightly
-rw-r--r-- | lib/async_req/async_sock.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c index 40e7bca4c8..1f48697f26 100644 --- a/lib/async_req/async_sock.c +++ b/lib/async_req/async_sock.c @@ -268,8 +268,8 @@ struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx, state->result = connect(fd, address, address_len); if (state->result == 0) { - errno = 0; - goto post_errno; + tevent_req_done(result); + goto done; } /** @@ -284,25 +284,22 @@ struct tevent_req *async_connect_send(TALLOC_CTX *mem_ctx, errno == EISCONN || #endif errno == EAGAIN || errno == EINTR)) { + state->sys_errno = errno; goto post_errno; } fde = tevent_add_fd(ev, state, fd, TEVENT_FD_READ | TEVENT_FD_WRITE, async_connect_connected, result); if (fde == NULL) { - errno = ENOMEM; + state->sys_errno = ENOMEM; goto post_errno; } return result; post_errno: - state->sys_errno = errno; + tevent_req_error(result, state->sys_errno); + done: fcntl(fd, F_SETFL, state->old_sockflags); - if (state->sys_errno == 0) { - tevent_req_done(result); - } else { - tevent_req_error(result, state->sys_errno); - } return tevent_req_post(result, ev); } |