fix various compiler warnings; most were due to unchecked return values from system calls.

--HG--
branch : HEAD
use gethostname() to determine the system host name

use getaddrinfo() to look up canonical DNS name, and fall back to hinting from /etc/resolv.conf

see #3298

--HG--
branch : HEAD
Backed out changeset 1142ed8974fa

--HG--
branch : HEAD
backout c1371176ea45

--HG--
branch : HEAD