diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-08-17 17:38:05 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-08-17 17:44:56 -0700 |
commit | a2a39436b65f329630df4a93ec4e30aeae403c54 (patch) | |
tree | 4003858e6a22b6b2f46453def20b60637653452e /lib/strtod.c | |
parent | eb81ccc4ebcba81ae42ef4b6c480d0e7d28fea1e (diff) | |
download | gnulib-a2a39436b65f329630df4a93ec4e30aeae403c54.tar.gz |
strtod: port errno handling to z/OS
* lib/strtod.c (strtod): Save and restore errno more reliably.
Diffstat (limited to 'lib/strtod.c')
-rw-r--r-- | lib/strtod.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/strtod.c b/lib/strtod.c index 34c6c4237e..7101d29041 100644 --- a/lib/strtod.c +++ b/lib/strtod.c @@ -215,7 +215,7 @@ strtod (const char *nptr, char **endptr) const char *s = nptr; const char *end; char *endbuf; - int saved_errno; + int saved_errno = errno; /* Eat whitespace. */ while (locale_isspace (*s)) @@ -226,7 +226,6 @@ strtod (const char *nptr, char **endptr) if (*s == '-' || *s == '+') ++s; - saved_errno = errno; num = underlying_strtod (s, &endbuf); end = endbuf; @@ -243,7 +242,7 @@ strtod (const char *nptr, char **endptr) end = s + 1; /* strtod() on z/OS returns ERANGE for "0x". */ - errno = 0; + errno = saved_errno; } else if (end <= s + 2) { |