提交 a634bbba 编写于 作者: P Peter Maydell

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: NPeter Maydell <peter.maydell@linaro.org>
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册