From a37d9a45d1ff1b5d311d190a8aac49bc2b2c7a9f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 23 Apr 2018 15:36:28 +0200 Subject: [PATCH] tevent: Fix callers of tevent_req_set_endtime tevent_req_set_endtime internally already calls tevent_req_nomem and thus sets the error status correctly. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/tevent/tevent.h | 3 ++- libcli/cldap/cldap.c | 1 - libcli/dns/dns.c | 1 - source3/lib/g_lock.c | 2 -- source3/lib/util_sock.c | 1 - source3/libsmb/namequery.c | 4 ---- source4/libcli/smb2/session.c | 1 - 7 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index 7bb9c618b2b..3ccac6a3600 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -1026,7 +1026,8 @@ struct tevent_req *_tevent_req_create(TALLOC_CTX *mem_ctx, #endif /** - * @brief Set a timeout for an async request. + * @brief Set a timeout for an async request. On failure, "req" is already + * set to state TEVENT_REQ_NO_MEMORY. * * @param[in] req The request to set the timeout for. * diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c index 242a1173017..daba37a21d7 100644 --- a/libcli/cldap/cldap.c +++ b/libcli/cldap/cldap.c @@ -663,7 +663,6 @@ struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx, } if (!tevent_req_set_endtime(req, state->caller.ev, end)) { - tevent_req_oom(req); goto post; } diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c index c30de2d4add..1321b1d2d38 100644 --- a/libcli/dns/dns.c +++ b/libcli/dns/dns.c @@ -97,7 +97,6 @@ static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx, if (!tevent_req_set_endtime(req, ev, timeval_current_ofs(DNS_REQUEST_TIMEOUT, 0))) { - tevent_req_oom(req); return tevent_req_post(req, ev); } diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index 9ce0e062275..bffbd6bab4d 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -387,7 +387,6 @@ struct tevent_req *g_lock_lock_send(TALLOC_CTX *mem_ctx, if (!tevent_req_set_endtime( fn_state.watch_req, state->ev, timeval_current_ofs(5 + sys_random() % 5, 0))) { - tevent_req_oom(req); return tevent_req_post(req, ev); } tevent_req_set_callback(fn_state.watch_req, g_lock_lock_retry, req); @@ -441,7 +440,6 @@ static void g_lock_lock_retry(struct tevent_req *subreq) if (!tevent_req_set_endtime( fn_state.watch_req, state->ev, timeval_current_ofs(5 + sys_random() % 5, 0))) { - tevent_req_oom(req); return; } tevent_req_set_callback(fn_state.watch_req, g_lock_lock_retry, req); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index c74fcd9138d..c97babeebe3 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -577,7 +577,6 @@ static void open_socket_out_connected(struct tevent_req *subreq) if (!tevent_req_set_endtime( subreq, state->ev, timeval_current_ofs_usec(state->wait_usec))) { - tevent_req_nterror(req, NT_STATUS_NO_MEMORY); return; } state->connect_subreq = subreq; diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 8c23f09f442..d2ce78675ff 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1666,7 +1666,6 @@ static struct tevent_req *name_queries_send( if (!tevent_req_set_endtime( subreq, state->ev, timeval_current_ofs(0, state->timeout_msec * 1000))) { - tevent_req_oom(req); return tevent_req_post(req, ev); } tevent_req_set_callback(subreq, name_queries_done, req); @@ -1749,7 +1748,6 @@ static void name_queries_next(struct tevent_req *subreq) if (!tevent_req_set_endtime( subreq, state->ev, timeval_current_ofs(0, state->timeout_msec * 1000))) { - tevent_req_oom(req); return; } state->subreqs[state->num_sent] = subreq; @@ -1986,7 +1984,6 @@ static struct tevent_req *query_wins_list_send( } if (!tevent_req_set_endtime(subreq, state->ev, timeval_current_ofs(2, 0))) { - tevent_req_oom(req); return tevent_req_post(req, ev); } tevent_req_set_callback(subreq, query_wins_list_done, req); @@ -2033,7 +2030,6 @@ static void query_wins_list_done(struct tevent_req *subreq) } if (!tevent_req_set_endtime(subreq, state->ev, timeval_current_ofs(2, 0))) { - tevent_req_oom(req); return; } tevent_req_set_callback(subreq, query_wins_list_done, req); diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c index e3e54cbe31a..b2cb8384f95 100644 --- a/source4/libcli/smb2/session.c +++ b/source4/libcli/smb2/session.c @@ -163,7 +163,6 @@ struct tevent_req *smb2_session_setup_spnego_send( ok = tevent_req_set_endtime(req, ev, endtime); if (!ok) { - tevent_req_oom(req); return tevent_req_post(req, ev); } -- 2.11.4.GIT