Properly catch and report getaddrinfo() errors

The getaddrinfo() function does not behave like a system call.  In particular,
the only successful return value is zero; any other value should be considered a
failure, not only -1.

This commit fixes a segfault caused by an invalid value of the "-l" command line
option.

This fixes #253