Fix checks against errno.EBADF and errno.EBADFD (they might not be available).
Allow ENOTCONN too.