Commit a634bbba authored by Peter Maydell's avatar Peter Maydell
Browse files

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: default avatarPeter Maydell <peter.maydell@linaro.org>
parents b8dc35b2 44fdc764
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -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;