From: Marcus Brinkmann Date: Fri, 22 Nov 2002 17:45:55 +0000 (+0000) Subject: 2002-11-22 Werner Koch X-Git-Tag: gpgme-1.2.0@1385~753 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=46639908f08f8eb44dfb2977cbc8f46979341108;p=gpgme.git 2002-11-22 Werner Koch * engine-gpgsm.c (_gpgme_gpgsm_new): Save the result of a first setlocale before doing another setlocale. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 6821198..53799be 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -2,6 +2,11 @@ * gpgme.h [_MSC_VER]: Define ssize_t as long. +2002-11-22 Werner Koch + + * engine-gpgsm.c (_gpgme_gpgsm_new): Save the result of a first + setlocale before doing another setlocale. + 2002-11-21 Marcus Brinkmann * decrypt.c: Some beautyfication. diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index 87bbb34..545d26a 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -464,7 +464,17 @@ gpgsm_new (void **engine) goto leave; } } + old_lc = setlocale (LC_CTYPE, NULL); + if (old_lc) + { + old_lc = strdup (old_lc); + if (!old_lc) + { + err = GPGME_Out_Of_Core; + goto leave; + } + } dft_lc = setlocale (LC_CTYPE, ""); if (dft_lc) { @@ -472,19 +482,32 @@ gpgsm_new (void **engine) err = mk_error (Out_Of_Core); else { - err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, NULL, NULL, NULL, - NULL); + err = assuan_transact (gpgsm->assuan_ctx, optstr, NULL, NULL, + NULL, NULL, NULL, NULL); free (optstr); if (err) err = map_assuan_error (err); } } if (old_lc) - setlocale (LC_CTYPE, old_lc); + { + setlocale (LC_CTYPE, old_lc); + free (old_lc); + } if (err) goto leave; + old_lc = setlocale (LC_MESSAGES, NULL); + if (old_lc) + { + old_lc = strdup (old_lc); + if (!old_lc) + { + err = GPGME_Out_Of_Core; + goto leave; + } + } dft_lc = setlocale (LC_MESSAGES, ""); if (dft_lc) { @@ -500,7 +523,10 @@ gpgsm_new (void **engine) } } if (old_lc) - setlocale (LC_MESSAGES, old_lc); + { + setlocale (LC_MESSAGES, old_lc); + free (old_lc); + } if (err) goto leave; }