1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-19 13:33:52 +01:00

18330: save output of setlocale as the pointer it returns gets clobbered

This commit is contained in:
Oliver Kiddle 2003-03-10 15:23:44 +00:00
parent a8a7df84ed
commit 1d80cc9acf
2 changed files with 5 additions and 2 deletions

@ -1,5 +1,8 @@
2003-03-10 Oliver Kiddle <opk@zsh.org> 2003-03-10 Oliver Kiddle <opk@zsh.org>
* 18330: Src/math.c: save output of setlocale as the pointer it
returns gets clobbered
* 18331: Completion/Unix/Command/_mh: use _call_program to avoid * 18331: Completion/Unix/Command/_mh: use _call_program to avoid
command not found errors, handle prefix-hidden style, make use of command not found errors, handle prefix-hidden style, make use of
_email_addresses and complete for more mh commands _email_addresses and complete for more mh commands

@ -399,12 +399,12 @@ zzlex(void)
/* it's a float */ /* it's a float */
yyval.type = MN_FLOAT; yyval.type = MN_FLOAT;
#ifdef USE_LOCALE #ifdef USE_LOCALE
prev_locale = setlocale(LC_NUMERIC, NULL); prev_locale = dupstring(setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "POSIX"); setlocale(LC_NUMERIC, "POSIX");
#endif #endif
yyval.u.d = strtod(ptr, &nptr); yyval.u.d = strtod(ptr, &nptr);
#ifdef USE_LOCALE #ifdef USE_LOCALE
setlocale(LC_NUMERIC, prev_locale); if (prev_locale) setlocale(LC_NUMERIC, prev_locale);
#endif #endif
if (ptr == nptr || *nptr == '.') { if (ptr == nptr || *nptr == '.') {
zerr("bad floating point constant", NULL, 0); zerr("bad floating point constant", NULL, 0);