mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2017-03-28' into staging
Miscellaneous patches for 2017-03-28 # gpg: Signature made Tue 28 Mar 2017 17:51:06 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-misc-2017-03-28: sockets: Fix socket_address_to_string() hostname truncation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+2
-7
@@ -1307,19 +1307,14 @@ char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
|
||||
{
|
||||
char *buf;
|
||||
InetSocketAddress *inet;
|
||||
char host_port[INET6_ADDRSTRLEN + 5 + 4];
|
||||
|
||||
switch (addr->type) {
|
||||
case SOCKET_ADDRESS_KIND_INET:
|
||||
inet = addr->u.inet.data;
|
||||
if (strchr(inet->host, ':') == NULL) {
|
||||
snprintf(host_port, sizeof(host_port), "%s:%s", inet->host,
|
||||
inet->port);
|
||||
buf = g_strdup(host_port);
|
||||
buf = g_strdup_printf("%s:%s", inet->host, inet->port);
|
||||
} else {
|
||||
snprintf(host_port, sizeof(host_port), "[%s]:%s", inet->host,
|
||||
inet->port);
|
||||
buf = g_strdup(host_port);
|
||||
buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user