Commit 78a8acc5 authored by Martin v. Löwis's avatar Martin v. Löwis

Patch #914291: Restore locale while readline is running.

parent ae075b6c
...@@ -821,6 +821,10 @@ readline_until_enter_or_signal(char *prompt, int *signal) ...@@ -821,6 +821,10 @@ readline_until_enter_or_signal(char *prompt, int *signal)
static char * static char *
call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
{ {
#ifdef SAVE_LOCALE
char *saved_locale = strdup(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, "");
#endif
size_t n; size_t n;
char *p, *q; char *p, *q;
int signal; int signal;
...@@ -879,6 +883,10 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) ...@@ -879,6 +883,10 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
p[n+1] = '\0'; p[n+1] = '\0';
} }
free(q); free(q);
#ifdef SAVE_LOCALE
setlocale(LC_CTYPE, saved_locale); /* Restore locale */
free(saved_locale);
#endif
return p; return p;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment