From 4b7b7b15d73a5f2a98229b12406b4397563d2983 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 11 May 2008 15:12:20 +0000 Subject: [PATCH] Fix up IPv6 address format to enclose it in [] git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/coling@2406 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/rtp/rtsp_client.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c index 22f0f0c..193248e 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -352,12 +352,14 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata const char *res = NULL; if (AF_INET == sa.sa.sa_family) { - res = inet_ntop(sa.sa.sa_family, &sa.in.sin_addr, buf, sizeof(buf)); + if ((res = inet_ntop(sa.sa.sa_family, &sa.in.sin_addr, buf, sizeof(buf)))) { + c->localip = pa_xstrdup(res); + } } else if (AF_INET6 == sa.sa.sa_family) { - res = inet_ntop(AF_INET6, &sa.in6.sin6_addr, buf, sizeof(buf)); + if ((res = inet_ntop(AF_INET6, &sa.in6.sin6_addr, buf, sizeof(buf)))) { + c->localip = pa_sprintf_malloc("[%s]", res); + } } - if (res) - c->localip = pa_xstrdup(res); } pa_log_debug("Established RTSP connection from local ip %s", c->localip); -- 2.7.4