- 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));