From a2176634aebf6e0ced4d26dd5be3bc93931a4fcb Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 25 Apr 2002 08:31:48 +0000 Subject: * call-agent.c (start_agent): Make copies of old locales and check for setlocale. * configure.ac: Check for setlocale. --- sm/ChangeLog | 5 +++++ sm/call-agent.c | 30 ++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'sm') diff --git a/sm/ChangeLog b/sm/ChangeLog index 639d78cb7..a594885e0 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,8 @@ +2002-04-25 Werner Koch + + * call-agent.c (start_agent): Make copies of old locales and check + for setlocale. + 2002-04-25 Marcus Brinkmann * call-agent.c (start_agent): Fix error handling logic so the diff --git a/sm/call-agent.c b/sm/call-agent.c index b3b18aef7..11b88f183 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -264,8 +264,14 @@ start_agent (void) if (rc) return map_assuan_err (rc); } -#ifdef LC_CTYPE +#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE) old_lc = setlocale (LC_CTYPE, NULL); + if (old_lc) + { + old_lc = strdup (old_lc); + if (!old_lc) + return GNUPG_Out_Of_Core; + } dft_lc = setlocale (LC_CTYPE, ""); #endif if (opt.lc_ctype || (dft_ttyname && dft_lc)) @@ -283,14 +289,23 @@ start_agent (void) rc = map_assuan_err (rc); } } -#ifdef LC_CTYPE +#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE) if (old_lc) - setlocale (LC_CTYPE, old_lc); + { + setlocale (LC_CTYPE, old_lc); + free (old_lc); + } #endif if (rc) return rc; -#ifdef LC_MESSAGES +#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) old_lc = setlocale (LC_MESSAGES, NULL); + if (old_lc) + { + old_lc = strdup (old_lc); + if (!old_lc) + return GNUPG_Out_Of_Core; + } dft_lc = setlocale (LC_MESSAGES, ""); #endif if (opt.lc_messages || (dft_ttyname && dft_lc)) @@ -308,9 +323,12 @@ start_agent (void) rc = map_assuan_err (rc); } } -#ifdef LC_MESSAGES +#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES) if (old_lc) - setlocale (LC_MESSAGES, old_lc); + { + setlocale (LC_MESSAGES, old_lc); + free (old_lc); + } #endif return rc; -- cgit v1.2.3