+ /*
+ * Improve error handling a bit. If we were given multiple IP addresses
+ * then return the old "no servers available" error, but point the user
+ * to -snoop (hopefully that's universal). Otherwise report a specific
+ * error.
+ */
+
+ if (res->ai_next)
+ snprintf(response, len_response, "no servers available (use -snoop "
+ "for details)");
+ else {
+ char port[NI_MAXSERV];
+
+ if (getnameinfo(res->ai_addr, res->ai_addrlen, NULL, 0, port,
+ sizeof port, NI_NUMERICSERV)) {
+ strncpy(port, "unknown", sizeof port);
+ port[sizeof(port) - 1] = '\0';
+ }