0002-Readline-8.2-patch-1-fix-crash-when-readline-is-star.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From b8d91eab12603fa88e095248855f5f772d182d05 Mon Sep 17 00:00:00 2001
  2. From: Chet Ramey <chet.ramey@case.edu>
  3. Date: Wed, 5 Oct 2022 10:41:16 -0400
  4. Subject: [PATCH] Readline-8.2 patch 1: fix crash when readline is started with
  5. an invalid locale specification
  6. Upstream: https://git.savannah.gnu.org/cgit/readline.git/patch/?id=7274faabe97ce53d6b464272d7e6ab6c1392837b
  7. [peter: stripped unrelated ._.gitignore change]
  8. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  9. ---
  10. nls.c | 4 ++++
  11. patchlevel | 2 +-
  12. 2 files changed, 5 insertions(+), 1 deletion(-)
  13. diff --git a/nls.c b/nls.c
  14. index 5c6a13b..8c027d6 100644
  15. --- a/nls.c
  16. +++ b/nls.c
  17. @@ -141,6 +141,10 @@ _rl_init_locale (void)
  18. if (lspec == 0)
  19. lspec = "";
  20. ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
  21. + if (ret == 0 || *ret == 0)
  22. + ret = setlocale (LC_CTYPE, (char *)NULL);
  23. + if (ret == 0 || *ret == 0)
  24. + ret = RL_DEFAULT_LOCALE;
  25. #else
  26. ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
  27. #endif
  28. diff --git a/patchlevel b/patchlevel
  29. index d8c9df7..fdf4740 100644
  30. --- a/patchlevel
  31. +++ b/patchlevel
  32. @@ -1,3 +1,3 @@
  33. # Do not edit -- exists only for use by patch
  34. -0
  35. +1
  36. --
  37. 2.39.2