@@ -2366,6 +2366,7 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
2366
2366
int error;
2367
2367
int arg;
2368
2368
char port_buf[NI_MAXSERV];
2369
+ const char *real_bind_addr_str;
2369
2370
MYSQL_SOCKET ip_sock= MYSQL_INVALID_SOCKET;
2370
2371
DBUG_ENTER (" activate_tcp_port" );
2371
2372
DBUG_PRINT (" general" ,(" IP Socket is %d" ,port));
@@ -2374,13 +2375,19 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
2374
2375
hints.ai_flags = AI_PASSIVE;
2375
2376
hints.ai_socktype = SOCK_STREAM;
2376
2377
hints.ai_family = AF_UNSPEC;
2378
+
2379
+ if (my_bind_addr_str && strcmp (my_bind_addr_str, " *" ) == 0 )
2380
+ real_bind_addr_str= NULL ; // windows doesn't seem to support * here
2381
+ else
2382
+ real_bind_addr_str= my_bind_addr_str;
2377
2383
2378
2384
my_snprintf (port_buf, NI_MAXSERV, " %d" , port);
2379
- error= getaddrinfo (my_bind_addr_str , port_buf, &hints, &ai);
2385
+ error= getaddrinfo (real_bind_addr_str , port_buf, &hints, &ai);
2380
2386
if (error != 0 )
2381
2387
{
2382
2388
DBUG_PRINT (" error" ,(" Got error: %d from getaddrinfo()" , error));
2383
- sql_perror (ER_DEFAULT (ER_IPSOCK_ERROR)); /* purecov: tested */
2389
+
2390
+ sql_print_error (" %s: %s" , ER_DEFAULT (ER_IPSOCK_ERROR), gai_strerror (error));
2384
2391
unireg_abort (1 ); /* purecov: tested */
2385
2392
}
2386
2393
@@ -2389,8 +2396,7 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
2389
2396
because we later switch off IPV6_V6ONLY, so ipv6 wildcard
2390
2397
addresses will work for ipv4 too
2391
2398
*/
2392
- if ((my_bind_addr_str == NULL || strcmp (my_bind_addr_str, " *" ) == 0 )
2393
- && ai->ai_family == AF_INET && ai->ai_next
2399
+ if (!real_bind_addr_str && ai->ai_family == AF_INET && ai->ai_next
2394
2400
&& ai->ai_next ->ai_family == AF_INET6)
2395
2401
{
2396
2402
a= ai;
0 commit comments