If the setsockopt() call succeeds but the following bind() fails, we
happily continue to process the address info structure. It seems wrong
to abort the loop if setsockopt() could not enable SO_REUSEADDR. Just
continue in this case.
*/
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on,
sizeof(on)) == -1) {
- ret = -ERRNO_TO_PARA_ERROR(errno);
close(sockfd);
- PARA_ERROR_LOG("can not set SO_REUSEADDR: %s\n",
- para_strerror(-ret));
- return ret;
+ continue;
}
if (bind(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
close(sockfd);