message when it fails reflects some random thing rather than what it returned. Set errno to the return value.