Catch more strtol() failures when using KEYRINGs

When parsing what should be a UID while resolving a KEYRING ccache name,
don't just depend on strtol() to set errno when the residual that we
pass to it can't be parsed as a number.  In addition to checking errno,
pass in and check the returned value of an "endptr".