for some reason, the linker needs --no-as-needed for both
libdl and libpthread.
closes#4
thanks to @tomsawyer for discovering this.
the proposed -pthread change was not needed though,
and this is a good thing since it seems not portable.
it called gethostbyname and expected that the h->h_name was set.
this code path here which gets only active if the passed name
equals the gethostname() result failed to set a couple of values.
additionally fixed usage of strncpy, which causes the entire
memory buffer to be written, even when the string is much shorter.
a similar bugfix was independently discovered by semion laptev, but my
version is threadsafe - his version introduces a new static buffer,
even though we have plenty of thread-safe space reserved exactly
for this usage case, thus causing a regression.