compare setsockopt result to 0 before returning

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

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

Loading…
Cancel
Save