]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
net.c: Combine host_and_port() and __get_sock_name().
authorAndre Noll <maan@systemlinux.org>
Fri, 22 Apr 2011 02:21:48 +0000 (04:21 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 May 2011 13:24:17 +0000 (15:24 +0200)
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.


No differences found