strtoul will return ULONG_MAX in case of error, but in the rest of the code we are comparing errno.