Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurajayaraman committed Oct 10, 2024
1 parent 4b485df commit ee175cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion starboard/nplb/posix_compliance/posix_socket_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ void PosixInitializePortNumberForTests() {
int local_add_result =
getsockname(socket_fd, reinterpret_cast<sockaddr*>(&addr_in), &socklen);

SB_DCHECK(local_add_result >= 0);
if (local_add_result < 0) {
ADD_FAILURE() << "Socket get local address failed: " << local_add_result;
HANDLE_EINTR(close(socket_fd));
return errno;
}
port_number_for_tests = addr_in.sin_port;

// Clean up the socket.
Expand Down

0 comments on commit ee175cf

Please sign in to comment.