if (NULL == h) { PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, _MD_GETHOST_ERRNO()); } else { _PRIPAddrConversion conversion = _PRIPAddrNoConversion; rv = CopyHostent(h, &buf, &bufsize, conversion, hp); if (PR_SUCCESS != rv) PR_SetError(PR_INSUFFICIENT_RESOURCES_ERROR, 0); } UNLOCK_DNS(); #if defined(_PR_HAVE_GETHOST_R) if (tmpbuf != localbuf) PR_Free(tmpbuf); #endif return rv;
PR_IMPLEMENT(const char *) PR_GetCanonNameFromAddrInfo(const PRAddrInfo *ai){#if defined(_PR_HAVE_GETADDRINFO)#if defined(_PR_INET6_PROBE)    if (!_pr_ipv6_is_present) {        const PRAddrInfoFB *fb = (const PRAddrInfoFB *) ai;        return fb->has_cname ? fb->hostent.h_name : NULL;    } #endif    return ((const PRADDRINFO *) ai)->ai_canonname;#else    const PRAddrInfoFB *fb = (const PRAddrInfoFB *) ai;    return fb->has_cname ? fb->hostent.h_name : NULL;#endif}