mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 04:40:59 +01:00
18330: save output of setlocale as the pointer it returns gets clobbered
This commit is contained in:
parent
a8a7df84ed
commit
1d80cc9acf
2 changed files with 5 additions and 2 deletions
|
|
@ -399,12 +399,12 @@ zzlex(void)
|
|||
/* it's a float */
|
||||
yyval.type = MN_FLOAT;
|
||||
#ifdef USE_LOCALE
|
||||
prev_locale = setlocale(LC_NUMERIC, NULL);
|
||||
prev_locale = dupstring(setlocale(LC_NUMERIC, NULL));
|
||||
setlocale(LC_NUMERIC, "POSIX");
|
||||
#endif
|
||||
yyval.u.d = strtod(ptr, &nptr);
|
||||
#ifdef USE_LOCALE
|
||||
setlocale(LC_NUMERIC, prev_locale);
|
||||
if (prev_locale) setlocale(LC_NUMERIC, prev_locale);
|
||||
#endif
|
||||
if (ptr == nptr || *nptr == '.') {
|
||||
zerr("bad floating point constant", NULL, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue