diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 444d5df42..bc060fcde 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -499,12 +499,14 @@ retry: rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof val); if (rc != 0) { close(fd); + fd = -1; /* error */ continue; } rc = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &val, sizeof val); if (rc != 0) { close(fd); + fd = -1; /* error */ continue; } @@ -514,6 +516,7 @@ retry: rc = setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &opts->priority, sizeof val); if (rc != 0) { close(fd); + fd = -1; /* error */ continue; } @@ -524,6 +527,7 @@ retry: rc = setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &val, sizeof val); if (rc != 0) { close(fd); + fd = -1; /* error */ continue; }