compare setsockopt result to 0 before returning

pull/5945/head
ahedberg 9 years ago
parent c9bfd0040a
commit d83ab26bdf
  1. 8
      src/core/iomgr/socket_utils_common_posix.c

@ -92,8 +92,8 @@ int grpc_set_socket_no_sigpipe_if_possible(int fd) {
int grpc_set_socket_ip_pktinfo_if_possible(int fd) {
#ifdef GPR_HAVE_IP_PKTINFO
int get_local_ip = 1;
return setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &get_local_ip,
sizeof(get_local_ip));
return 0 == setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &get_local_ip,
sizeof(get_local_ip));
#else
return 1;
#endif
@ -102,8 +102,8 @@ int grpc_set_socket_ip_pktinfo_if_possible(int fd) {
int grpc_set_socket_ipv6_recvpktinfo_if_possible(int fd) {
#ifdef GPR_HAVE_IPV6_RECVPKTINFO
int get_local_ip = 1;
return setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &get_local_ip,
sizeof(get_local_ip));
return 0 == setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &get_local_ip,
sizeof(get_local_ip));
#else
return 1;
#endif

Loading…
Cancel
Save