From: Simon McVittie Date: Wed, 4 Feb 2015 13:15:20 +0000 (+0000) Subject: _dbus_listen_tcp_socket: use NI_NUMERICSERV to determine port number X-Git-Tag: dbus-1.9.10~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d70675e940ab6295e6032e8e7b6362083c35745a;p=thirdparty%2Fdbus.git _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 --- diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index f4a42d89f..f6ec8abc5 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)",