Skip to content

Commit

Permalink
Use IPPROTO_TCP if getprotobyname("TCP") fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-marsh committed Sep 28, 2017
1 parent a76a59a commit f65ccf1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libwebsockets-1.7.3/lib/lws-plat-win.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,13 @@ lws_plat_set_socket_options(struct lws_context *context, lws_sockfd_type fd)
optval = 1;
#ifndef _WIN32_WCE
tcp_proto = getprotobyname("TCP");
if (!tcp_proto) {
if (tcp_proto) {
protonbr = tcp_proto->p_proto;
}
else {
lwsl_err("getprotobyname() failed with error %d\n", LWS_ERRNO);
return 1;
protonbr = IPPROTO_TCP;
}
protonbr = tcp_proto->p_proto;
#else
protonbr = 6;
#endif
Expand Down

0 comments on commit f65ccf1

Please sign in to comment.