cvs commit: ALFS/nALFS/src init.c options.c

Neven Has haski at sezampro.yu
Tue Nov 4 19:36:21 PST 2003


On Tue, Nov 04, 2003 at 08:21:58PM -0700, kpfleming at linuxfromscratch.org wrote:
>   +	*val = (NUMBER) strtol(input, &tmp, 10);
>   +			
>   +	if (tmp != NULL && *tmp) {
>   +		option_invalid(option,
>   +			       "%s\n\textraneous characters found (%s).",
>   +			       input, tmp);
>   +		status = 0;
>   +	} else if (errno) {

Are you sure errno is touched when strtol() doesn't fail?  It's set to
ERANGE on under/overflow, but I don't know if it's set to 0 otherwise.
I know C standard doesn't guarantee that, I'm not sure about others.

You should probably put errno = 0 before a call to strtol(), just to
be sure.


Neven




More information about the alfs-log mailing list