Revert "Revert "use POSIX version of esrerror_r""

This reverts commit ecd6ba76783c7f3cf2bd4bacce760bc37c17007f.

Because it introduced problems on OSX
Use strerror only, simplify

Should fix #53