Blame SOURCES/openssh-8.0p1-x11-without-ipv6.patch

3009ed
diff --git a/channels.c b/channels.c
3009ed
--- a/channels.c
3009ed
+++ b/channels.c
3009ed
@@ -3933,16 +3933,26 @@ x11_create_display_inet(int x11_display_
3009ed
 			if (ai->ai_family == AF_INET6)
3009ed
 				sock_set_v6only(sock);
3009ed
 			if (x11_use_localhost)
3009ed
 				set_reuseaddr(sock);
3009ed
 			if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
3009ed
 				debug2("%s: bind port %d: %.100s", __func__,
3009ed
 				    port, strerror(errno));
3009ed
 				close(sock);
3009ed
+
3009ed
+				/* do not remove successfully opened
3009ed
+				 * sockets if the request failed because
3009ed
+				 * the protocol IPv4/6 is not available
3009ed
+				 * (e.g. IPv6 may be disabled while being
3009ed
+				 * supported)
3009ed
+				 */
3009ed
+				if (EADDRNOTAVAIL == errno)
3009ed
+    					continue;
3009ed
+
3009ed
 				for (n = 0; n < num_socks; n++)
3009ed
 					close(socks[n]);
3009ed
 				num_socks = 0;
3009ed
 				break;
3009ed
 			}
3009ed
 			socks[num_socks++] = sock;
3009ed
 			if (num_socks == NUM_SOCKS)
3009ed
 				break;