Be even more resilient in error checking. Do not rely on errno.

errno might have an unpredictable value on the more esoteric Unices.