about summary refs log tree commit diff
path: root/stdlib/strtod_l.c
diff options
context:
space:
mode:
authorHerman ten Brugge <hermantenbrugge@home.nl>2018-06-15 17:35:17 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-06-15 17:35:17 +0000
commitb0debe14fcfe690eee8b5e693554dd258603805d (patch)
treec393efa15c55dba3efa488b10a6bd861f3372791 /stdlib/strtod_l.c
parent14beef7575099f6373f9a45b4656f1e3675f7372 (diff)
downloadglibc-b0debe14fcfe690eee8b5e693554dd258603805d.tar.gz
glibc-b0debe14fcfe690eee8b5e693554dd258603805d.tar.xz
glibc-b0debe14fcfe690eee8b5e693554dd258603805d.zip
Fix sign of NaN returned by strtod (bug 23007).
As reported in bug 23007, strtod ignores any sign in the input string
in the case of a NaN result.  Thes patch fixes this.

Tested for x86_64 (in conjunction with tests to be added separately).

	[BZ #23007]
	* stdlib/strtod_l.c (____STRTOF_INTERNAL): Return NaN of
	appropriate sign.
Diffstat (limited to 'stdlib/strtod_l.c')
-rw-r--r--stdlib/strtod_l.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index a09b093fce..cbff18b49d 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -678,7 +678,7 @@ ____STRTOF_INTERNAL (const STRING_TYPE *nptr, STRING_TYPE **endptr, int group,
 	  if (endptr != NULL)
 	    *endptr = (STRING_TYPE *) cp;
 
-	  return retval;
+	  return negative ? -retval : retval;
 	}
 
       /* It is really a text we do not recognize.  */