- rsyserr(FERROR, errno, "failed to connect to %s", h);
- return -1;
+ char buf[2048];
+ for (res = res0, j = 0; res; res = res->ai_next, j++) {
+ if (errnos[j] == 0)
+ continue;
+ if (inet_ntop(res->ai_family, res->ai_addr->sa_data + 2, buf, sizeof buf) == NULL)
+ strlcpy(buf, "*inet_ntop failed*", sizeof buf);
+ rsyserr(FERROR, errnos[j], "failed to connect to %s (%s)", h, buf);
+ }
+ s = -1;