Skip to content

Commit

Permalink
fix expression bug on socket creation failure (fd<0 is always false b…
Browse files Browse the repository at this point in the history
…ecause fd is unsigned and Windows returns ~0 (-1) on socket failure)
zeliard committed Apr 27, 2015
2 parents 81f750e + 7305dc6 commit 04ddd8c
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/core/util/port_windows.c
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ static int is_port_available(int *port, int is_tcp) {

GPR_ASSERT(*port >= 0);
GPR_ASSERT(*port <= 65535);
if (fd < 0) {
if (INVALID_SOCKET == fd) {
gpr_log(GPR_ERROR, "socket() failed: %s", strerror(errno));
return 0;
}
4 changes: 2 additions & 2 deletions vsprojects/grpc_test_util/grpc_test_util.vcxproj
Original file line number Diff line number Diff line change
@@ -146,14 +146,14 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\server1_cert.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\server1_key.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\data\test_root_cert.c">
</ClCompile>
<ClCompile Include="..\..\test\core\end2end\cq_verifier.c">
</ClCompile>
<ClCompile Include="..\..\test\core\iomgr\endpoint_tests.c">
</ClCompile>
<ClCompile Include="..\..\test\core\statistics\census_log_tests.c">

0 comments on commit 04ddd8c

Please sign in to comment.