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. thanks, Pádraig.