grains/core : fix fqdn / domain return on SunOS systems

getfqdn() on Solaris platforms returns the unqualified hostname. In
that case, using gethostname() could be a solution.

Tested on SmartOS / Solaris 11 / FreeBSD