return errno on failure, not just false