hints.ai_family = local ? local->sa_family : 0;
hints.ai_socktype = SOCK_STREAM;
snprintf(portnum, sizeof(portnum), "%u", port);
- if (getaddrinfo(peer, portnum, &hints, &ai)) {
- log_module(MAIN_LOG, LOG_ERROR, "getaddrinfo(%s, %s) failed.", peer, portnum);
+ res = getaddrinfo(peer, portnum, &hints, &ai);
+ if (res != 0) {
+ log_module(MAIN_LOG, LOG_ERROR, "getaddrinfo(%s, %s) failed: %s.", peer, portnum, gai_strerror(res));
return NULL;
}
}
res = getnameinfo(sa, sa_len, namebuf, buflen, NULL, 0, NI_NUMERICHOST);
if (res != 0) {
- log_module(MAIL_LOG, LOG_ERROR, "Unable to get text form of socket name: %s", strerror(errno));
+ log_module(MAIL_LOG, LOG_ERROR, "Unable to get text form of socket name: %s", gai_strerror(res));
}
}