diff options
author | Werner Koch <[email protected]> | 2002-04-25 08:31:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2002-04-25 08:31:48 +0000 |
commit | a2176634aebf6e0ced4d26dd5be3bc93931a4fcb (patch) | |
tree | cd0080bd207d3f0427c9979a828d1a538fa69c94 /sm/call-agent.c | |
parent | 2002-04-25 Marcus Brinkmann <[email protected]> (diff) | |
download | gnupg-a2176634aebf6e0ced4d26dd5be3bc93931a4fcb.tar.gz gnupg-a2176634aebf6e0ced4d26dd5be3bc93931a4fcb.zip |
* call-agent.c (start_agent): Make copies of old locales and check
for setlocale.
* configure.ac: Check for setlocale.
Diffstat (limited to '')
-rw-r--r-- | sm/call-agent.c | 30 |
1 files changed, 24 insertions, 6 deletions
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; |