fix for readline to handle setlocale() returning NULL

This commit is contained in:
Chet Ramey
2022-10-07 17:44:03 -04:00
parent 43e861c2cd
commit 38d9d3590f
5 changed files with 19 additions and 3 deletions
+2
View File
@@ -151,7 +151,9 @@ int rl_timeout_remaining (unsigned int *, unsigned int *);
int _rl_timeout_init (void);
int _rl_timeout_sigalrm_handler (void);
#if defined (RL_TIMEOUT_USE_SELECT)
int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
#endif
static void _rl_timeout_handle (void);
#if defined (RL_TIMEOUT_USE_SIGALRM)
+4
View File
@@ -141,6 +141,10 @@ _rl_init_locale (void)
if (lspec == 0)
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
if (ret == 0 || *ret == 0)
ret = setlocale (LC_CTYPE, NULL);
if (ret == 0 || *ret == 0)
ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
#endif
+1 -1
View File
@@ -303,7 +303,7 @@ extern int _rl_pushed_input_available (void);
extern int _rl_timeout_init (void);
extern int _rl_timeout_handle_sigalrm (void);
#if defined (_POSIXSELECT_H_)
#if defined (_POSIXSELECT_H_) && !defined (__MINGW32__)
/* use as a sentinel for fd_set, struct timeval, and sigset_t definitions */
extern int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
#endif