[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xstrtol: ensure errno is reset

From: Pádraig Brady
Subject: Re: [PATCH] xstrtol: ensure errno is reset
Date: Wed, 31 Dec 2014 17:40:51 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 31/12/14 15:34, Paul Eggert wrote:
> Pádraig Brady wrote:
>> strtol is documented to return ERANGE in certain cases,
>> and the coreutils xdectoint wrapper uses and sets errno
>> to give more accurate diagnostics.
> Sure, but this is xstrtol, not strtol.  xstrtol returns its error indicator 
> as a 
> strtol_error value.  It would be weird to insist that xstrtol must also set 
> errno.  If there's some finer-grained error indication that xdectoint needs 
> from 
> xstrtol, this should be fixed by adding new values to enum strtol_error.

Fair point.  What we have now works well though, so I'm not on for changing 
immediately at least.
To make it more consistent would be a more invasive change, with probably the 
refactoring of
xstrtol_error() to something more general, and then using that after all 
xstrtol callers in coreutils etc.

>>> Second, can't isspace set errno and won't this cause problems?
>> That would be surprising.
> I've been surprised before.  :-)  Perhaps isspace, the first time it's 
> called, 
> reads a table from somewhere.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]