- if (!(hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET))) {
- xlog(L_ERROR, "can't get hostname of %s", inet_ntoa(addr));
- xfunlock(lockid);
- return;
+ hostname = host_canonname(sap);
+ if (hostname == NULL) {
+ char buf[INET6_ADDRSTRLEN];
+ xlog(L_ERROR, "can't get hostname of %s",
+ host_ntop(sap, buf, sizeof(buf)));
+ goto out_unlock;