c-strtod: when ENDPTR is non-NULL, set *ENDPTR in new failure path
authorJim Meyering <meyering@redhat.com>
Fri, 23 Jan 2009 15:21:57 +0000 (16:21 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 23 Jan 2009 16:33:01 +0000 (17:33 +0100)
* lib/c-strtod.c (C_STRTOD) [LC_ALL_MASKC]: Ensure that when
ENDPTR is non-NULL, *ENDPTR is set to NPTR upon failure.

ChangeLog
lib/c-strtod.c

index ca37425878d79edb6a6a215043134e828497f4d0..66a6632c26875888c830d310ae6b521be6ff8a72 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-23  Jim Meyering  <meyering@redhat.com>
+
+       c-strtod: when ENDPTR is non-NULL, set *ENDPTR in new failure path
+       * lib/c-strtod.c (C_STRTOD) [LC_ALL_MASKC]: Ensure that when
+       ENDPTR is non-NULL, *ENDPTR is set to NPTR upon failure.
+
 2009-01-23  Simon Josefsson  <simon@josefsson.org>
 
        * lib/version-etc.c: Add emit_bug_reporting_address, inspired by
index 3d0fae99560dff70ba53334aff83f4faf5bfa2fd..77e5aaf80d37acbc8db11aa7faa94acbd07c0696 100644 (file)
@@ -72,7 +72,11 @@ C_STRTOD (char const *nptr, char **endptr)
 
   locale_t locale = c_locale ();
   if (!locale)
-    return 0; /* errno is set here */
+    {
+      if (endptr)
+        *endptr = nptr;
+      return 0; /* errno is set here */
+    }
 
   r = STRTOD_L (nptr, endptr, locale);