Bruno Haible <br...@clisp.org> wrote:
> getloadavg uses c_strtod, but does not completely chcek against all error
> conditions (such as EINVAL or ENOMEM). Here's a proposed patch to that effect.
>
> The strtod documentation in POSIX says:
>   "Since 0 is returned on error and is also a valid return on success, an
>    application wishing to check for error situations should set errno to 0,
>    then call strtod(), strtof(), or strtold(), then check errno."
> This applies also to c_strtod, since it call strtod().
>
> The test for 'ptr == endptr' is still necessary, though, since at least
> on glibc systems,  strtod ("foo", &endptr)  returns 0 with errno = 0.
>
> OK to commit?
>
> 2009-01-21  Bruno Haible  <br...@clisp.org>
>
>       * lib/getloadavg.c (getloadavg): Check c_strtod result against error
>       conditions other than overflow.

Fine change.  Thanks.
Go ahead.


Reply via email to