in https://www.freebsd.org/cgi/man.cgi?query=resolver we read : The res_mkquery(), res_search(), and res_query() functions return the size of the response on success, or -1 if an error occurs. The integer h_errno may be checked to determine the reason for error. See gethostbyname(3) for more information. in http://man7.org/linux/man-pages/man3/resolver.3.html , h_errno is not mentioned but in the end of this page we read CONFORMING TO 4.3BSD. the fact that h_errno is really modified as specified by BSD, could be confirmed experimentally, but would not it be more convenient if this was mentioned documentally ?