]> git.tue.mpg.de Git - paraslash.git/commitdiff
net: Let makesock() continue on setsockopt() failure.
authorAndre Noll <maan@systemlinux.org>
Sun, 8 Sep 2013 05:21:22 +0000 (05:21 +0000)
committerAndre Noll <maan@systemlinux.org>
Wed, 1 Jan 2014 17:49:53 +0000 (17:49 +0000)
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.

net.c

diff --git a/net.c b/net.c
index b7806a18e075f091c87611b0c64e43bdf711500b..822f70def6aee8f6cf6e202832ab02c4553628b8 100644 (file)
--- a/net.c
+++ b/net.c
@@ -443,11 +443,8 @@ static int makesock_addrinfo(unsigned l4type, bool passive, struct addrinfo *ai,
                 */
                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);