1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 20:11:11 +00:00

Fix hostname resolution for mpd_host

When getaddrinfo() returns an IPv6 address, connect() fails since mpd
does not support IPv6. Reproduced by adding the name "localhost" to the
"::1" entry in /etc/hosts.

Signed-off-by: Brenden Matthews <brenden@rty.ca>
This commit is contained in:
Phil Sutter 2009-05-31 03:36:12 +02:00 committed by Brenden Matthews
parent 0632693be7
commit 533075032a
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2009-05-31
* Fix hostname resolution for mpd_host
2009-05-24
* Added fancy new 'temperature gradients' feature for graphs, via the -t
switch at the end of graph arguments.

View File

@ -126,9 +126,13 @@ static int mpd_connect(mpd_Connection *connection, const char *host, int port,
struct addrinfo *res = NULL;
struct addrinfo *addrinfo = NULL;
/* Setup hints */
/* Setup hints
*
* XXX: limit address family to PF_INET here.
* MPD does not support IPv6 yet, so if GAI returns
* an IPv6 address, the later connect() will fail. */
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = PF_UNSPEC;
hints.ai_family = PF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_addrlen = 0;