net.c: Combine host_and_port() and __get_sock_name().
host_and_port() is only called by __get_sock_name().
Both functions are short enough, and merging these
two functions has the additional benefit that we can
always return the same static buffer.
Compiling with -Wwrite-strings previously caused a
warning due to returning either a string literal, or
the static buffer. We now always print into that buffer
and return it.
This also improves the error message which is returned
in the static buffer in case of failures: Previously we
returned "(don't know)" if getname() failed and "(unknown)"
if getnameinfo() failed. This turns it into "(unknown)" in
the former case and "(lookup error)" otherwise.