Skip to content

Commit

Permalink
src: fix unchecked return warning from coverity
Browse files Browse the repository at this point in the history
Fix unchecked return warning from coverity in
src/env.cc. Added check in same manner as other
places where uv_async_init is called.

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #42176
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
mhdawson authored and danielleadams committed Apr 24, 2022
1 parent 6545094 commit 830f93d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/env.cc
Expand Up @@ -545,21 +545,21 @@ void Environment::InitializeLibuv() {
CHECK_EQ(0, uv_timer_init(event_loop(), timer_handle()));
uv_unref(reinterpret_cast<uv_handle_t*>(timer_handle()));

uv_check_init(event_loop(), immediate_check_handle());
CHECK_EQ(0, uv_check_init(event_loop(), immediate_check_handle()));
uv_unref(reinterpret_cast<uv_handle_t*>(immediate_check_handle()));

uv_idle_init(event_loop(), immediate_idle_handle());
CHECK_EQ(0, uv_idle_init(event_loop(), immediate_idle_handle()));

uv_check_start(immediate_check_handle(), CheckImmediate);
CHECK_EQ(0, uv_check_start(immediate_check_handle(), CheckImmediate));

// Inform V8's CPU profiler when we're idle. The profiler is sampling-based
// but not all samples are created equal; mark the wall clock time spent in
// epoll_wait() and friends so profiling tools can filter it out. The samples
// still end up in v8.log but with state=IDLE rather than state=EXTERNAL.
uv_prepare_init(event_loop(), &idle_prepare_handle_);
uv_check_init(event_loop(), &idle_check_handle_);
CHECK_EQ(0, uv_prepare_init(event_loop(), &idle_prepare_handle_));
CHECK_EQ(0, uv_check_init(event_loop(), &idle_check_handle_));

uv_async_init(
CHECK_EQ(0, uv_async_init(
event_loop(),
&task_queues_async_,
[](uv_async_t* async) {
Expand All @@ -568,7 +568,7 @@ void Environment::InitializeLibuv() {
HandleScope handle_scope(env->isolate());
Context::Scope context_scope(env->context());
env->RunAndClearNativeImmediates();
});
}));
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_prepare_handle_));
uv_unref(reinterpret_cast<uv_handle_t*>(&idle_check_handle_));
uv_unref(reinterpret_cast<uv_handle_t*>(&task_queues_async_));
Expand Down

0 comments on commit 830f93d

Please sign in to comment.