Use MAXLOGNAME instead of LOGIN_NAME_MAX, more portable.
Make it work on systems without MSG_NOSIGNAL.

Mac OS X for some stupid reason decided to not have MSG_NOSIGNAL and
instead have the fd/socket option F_SETNOSIGPIPE/SO_NOSIGPIPE.