# HG changeset patch # User Bruno Haible # Date 1294432043 -3600 # Node ID a94d9a7b4aaa5db27586026139f76a98a4e8f666 # Parent a0e5b329796848a43b45dc86f828f18239345b92 strtod: Restore errno when successfully parsing Infinity or NaN. * lib/strtod.c (strtod): After successfully parsing an Infinity or NaN, restore the original errno. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-01-07 Bruno Haible + + strtod: Restore errno when successfully parsing Infinity or NaN. + * lib/strtod.c (strtod): After successfully parsing an Infinity or NaN, + restore the original errno. + 2011-01-07 Bruno Haible remove test: Avoid failure on HP-UX 11. diff --git a/lib/strtod.c b/lib/strtod.c --- a/lib/strtod.c +++ b/lib/strtod.c @@ -303,6 +303,7 @@ && c_tolower (s[4]) == 'y') s += 5; num = HUGE_VAL; + errno = saved_errno; } else if (c_tolower (*s) == 'n' && c_tolower (s[1]) == 'a' @@ -325,6 +326,7 @@ to interpreting n-char-sequence as a hexadecimal number. */ if (s != end) num = NAN; + errno = saved_errno; } else {