From a4408c58f7473325e49c7469ad13c34d938c8b11 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 4 Feb 2015 13:15:20 +0000 Subject: [PATCH 1/2] _dbus_listen_tcp_socket: use NI_NUMERICSERV to determine port number If we happen to have been given (say) port 30865, we want to represent that as host=localhost,port=30865 and not host=localhost,port=csync2. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999 --- dbus/dbus-sysdeps-unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index f4a42d8..f6ec8ab 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1518,7 +1518,7 @@ _dbus_listen_tcp_socket (const char *host, if (result == -1 || (res = getnameinfo ((struct sockaddr*)&addr, addrlen, NULL, 0, portbuf, sizeof(portbuf), - NI_NUMERICHOST)) != 0) + NI_NUMERICHOST | NI_NUMERICSERV)) != 0) { dbus_set_error (error, _dbus_error_from_errno (errno), "Failed to resolve port \"%s:%s\": %s (%s)", -- 2.1.4