Fix broken net_address_to_string().
This commit is contained in:
parent
1bb3bd90c1
commit
4711d26c11
@ -526,12 +526,15 @@ const char* net_address_to_string(int af, const void* src, char* dst, socklen_t
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
const char* address = inet_ntop(af, src, dst, cnt);
|
if (inet_ntop(af, src, dst, cnt))
|
||||||
if (af == AF_INET6 && strncmp(address, "::ffff:", 7) == 0) /* IPv6 mapped IPv4 address. */
|
|
||||||
{
|
{
|
||||||
return &address[7];
|
if (af == AF_INET6 && strncmp(dst, "::ffff:", 7) == 0) /* IPv6 mapped IPv4 address. */
|
||||||
|
{
|
||||||
|
memmove(dst, dst + 7, cnt - 7);
|
||||||
|
}
|
||||||
|
return dst;
|
||||||
}
|
}
|
||||||
return address;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user