From 9d4035dfc092572c8f53f20d8335ab3045a9b5d5 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Fri, 16 Mar 2012 15:17:53 +0100 Subject: [PATCH] Fix hostname detection --- libatalk/dsi/dsi_tcp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libatalk/dsi/dsi_tcp.c b/libatalk/dsi/dsi_tcp.c index 37a00bf4..6e7ac974 100644 --- a/libatalk/dsi/dsi_tcp.c +++ b/libatalk/dsi/dsi_tcp.c @@ -249,9 +249,10 @@ static void guess_interface(DSI *dsi, const char *hostname, const char *port) getip_string((struct sockaddr *)&dsi->server), port, ifr.ifr_name); goto iflist_done; } - LOG(log_info, logtype_dsi, "dsi_tcp (Chooser will not select afp/tcp) " - "Check to make sure %s is in /etc/hosts and the correct domain is in " - "/etc/resolv.conf: %s", hostname, strerror(errno)); + + LOG(log_note, logtype_dsi, "dsi_tcp: couldn't find network interface with IP address to advertice, " + "check to make sure \"%s\" is in /etc/hosts or can be resolved with DNS, or " + "add a netinterface that is not a loopback or point-2-point type", hostname); iflist_done: close(fd); @@ -267,7 +268,7 @@ iflist_done: int dsi_tcp_init(DSI *dsi, const char *hostname, const char *inaddress, const char *inport) { EC_INIT; - int flag; + int flag, err; char *a = NULL, *b; const char *address; const char *port; @@ -377,8 +378,8 @@ int dsi_tcp_init(DSI *dsi, const char *hostname, const char *inaddress, const ch hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - if ((ret = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) { - LOG(log_info, logtype_dsi, "dsi_tcp_init: getaddrinfo '%s': %s\n", hostname, gai_strerror(ret)); + if ((err = getaddrinfo(hostname, port, &hints, &servinfo)) != 0) { + LOG(log_info, logtype_dsi, "dsi_tcp_init: getaddrinfo '%s': %s\n", hostname, gai_strerror(err)); goto interfaces; } -- 2.39.2