Skip to content

Commit

Permalink
test: check uv_ip4_addr return value
Browse files Browse the repository at this point in the history
Fixes Coverity errors.

PR-URL: #13878
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
Eugene Ostroukhov committed Jun 26, 2017
1 parent 6bf4c23 commit 5fbbd25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/cctest/test_inspector_socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class InspectorSocketTest : public ::testing::Test {
sockaddr_in addr;
uv_tcp_init(&loop, &server);
uv_tcp_init(&loop, &client_socket);
uv_ip4_addr("127.0.0.1", PORT, &addr);
GTEST_ASSERT_EQ(0, uv_ip4_addr("127.0.0.1", PORT, &addr));
uv_tcp_bind(&server, reinterpret_cast<const struct sockaddr*>(&addr), 0);
GTEST_ASSERT_EQ(0, uv_listen(reinterpret_cast<uv_stream_t*>(&server),
1, on_new_connection));
Expand Down
9 changes: 5 additions & 4 deletions test/cctest/test_inspector_socket_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ class SocketWrapper {
contents_.clear();
uv_tcp_init(loop_, &socket_);
sockaddr_in addr;
uv_ip4_addr(host.c_str(), port, &addr);
int err = uv_tcp_connect(&connect_, &socket_,
reinterpret_cast<const sockaddr*>(&addr),
ConnectionMustFail_);
int err = uv_ip4_addr(host.c_str(), port, &addr);
ASSERT_EQ(0, err);
err = uv_tcp_connect(&connect_, &socket_,
reinterpret_cast<const sockaddr*>(&addr),
ConnectionMustFail_);
ASSERT_EQ(0, err);
SPIN_WHILE(!connection_failed_)
uv_read_start(reinterpret_cast<uv_stream_t*>(&socket_), AllocCallback,
Expand Down

0 comments on commit 5fbbd25

Please sign in to comment.