getnameinfo() does not return FQDN of a host
807557Mar 9 2008 — edited Aug 2 2008The man page of getnameinfo() says that:
int getnameinfo(const struct sockaddr sa, socklen_t salen, char host,
size_t hostlen, char *serv, size_t servlen, int flags);
The final argument is a flag that changes the default
actions of this function. By default, the fully-qualified
domain name (FQDN) for the host is looked up in the name
service database and returned.
I call getnameinfo() with flags set to 0 and it returns only the nodename portion of the FQDN.
I was able to get the FQDN on the same host a couple of months ago. I do not know what my sysadmin had done since then. This is my system info:
homer% uname -a
SunOS homer 5.10 Generic_118855-33 i86pc i386 i86pc
homer% which gcc
/pkg/gcc/4.2.1/bin/gcc
By the way, is there a function that surely returns the FQDN of a host?