From c80a91609d5ace95267f17cd44b244865378d064 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Mon, 19 Feb 2001 06:19:51 +0000 Subject: [PATCH] Deal properly with "0" --- lib/libc/locale/fix_grouping.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libc/locale/fix_grouping.c b/lib/libc/locale/fix_grouping.c index a2675d8eb9d2..a63889c7be57 100644 --- a/lib/libc/locale/fix_grouping.c +++ b/lib/libc/locale/fix_grouping.c @@ -68,7 +68,11 @@ __fix_locale_grouping_str(const char *str) { n += *src - '0'; } - *dst++ = n; + *dst = n; + /* NOTE: assume all input started with "0" as 'no grouping' */ + if (*dst == '\0') + return (dst == (char*)str) ? nogrouping : str; + dst++; } *dst = '\0'; return str;