Dear all,
xstrtod always modifies *result; according with
the doc. string it should modify *result only
when the conversion has no errors.
From 4590ec480a8883e2c2da4c59641d9a401b41f12f Mon Sep 17 00:00:00 2001
From: Tino Calancha <f92ca...@gmail.com>
Date: Thu, 14 Apr 2016 14:28:21 +0900
Subject: [PATCH] xstrtod: modify *result only if no errors.
* lib/xstrtod.c (XSTRTOD).
---
lib/xstrtod.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/xstrtod.c b/lib/xstrtod.c
index 2ce0451..1320ab6 100644
--- a/lib/xstrtod.c
+++ b/lib/xstrtod.c
@@ -66,6 +66,7 @@ XSTRTOD (char const *str, char const **ptr, DOUBLE *result,
if (ptr != NULL)
*ptr = terminator;
- *result = val;
+ if (ok)
+ *result = val;
return ok;
}
--
2.8.0.rc3