io: don't leave errno as a random value when we hit EOF.