diff options
Diffstat (limited to '')
-rw-r--r-- | sm/ChangeLog | 5 | ||||
-rw-r--r-- | sm/call-agent.c | 42 |
2 files changed, 30 insertions, 17 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog index 660b726e3..639d78cb7 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,5 +1,10 @@ 2002-04-25 Marcus Brinkmann <[email protected]> + * call-agent.c (start_agent): Fix error handling logic so the + locale is always correctly reset. + +2002-04-25 Marcus Brinkmann <[email protected]> + * server.c (option_handler): Accept display, ttyname, ttytype, lc_ctype and lc_messages options. * gpgsm.c (main): Allocate memory for these options. diff --git a/sm/call-agent.c b/sm/call-agent.c index 0e0c60923..b3b18aef7 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -132,7 +132,7 @@ get_membuf (struct membuf *mb, size_t *len) static int start_agent (void) { - int rc; + int rc = 0; char *infostr, *p; ASSUAN_CONTEXT ctx; char *dft_display = NULL; @@ -252,7 +252,7 @@ start_agent (void) return map_assuan_err (rc); } dft_ttytype = getenv ("TERM"); - if (!rc && (opt.ttytype || (dft_ttyname && dft_ttytype))) + if (opt.ttytype || (dft_ttyname && dft_ttytype)) { char *optstr; if (asprintf (&optstr, "OPTION ttytype=%s", @@ -268,44 +268,52 @@ start_agent (void) old_lc = setlocale (LC_CTYPE, NULL); dft_lc = setlocale (LC_CTYPE, ""); #endif - if (!rc && (opt.lc_ctype || (dft_ttyname && dft_lc))) + if (opt.lc_ctype || (dft_ttyname && dft_lc)) { char *optstr; if (asprintf (&optstr, "OPTION lc-ctype=%s", opt.lc_ctype ? opt.lc_ctype : dft_lc) < 0) - return GNUPG_Out_Of_Core; - rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL, - NULL); - free (optstr); - if (rc) - return map_assuan_err (rc); + rc = GNUPG_Out_Of_Core; + else + { + rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL, + NULL); + free (optstr); + if (rc) + rc = map_assuan_err (rc); + } } #ifdef LC_CTYPE if (old_lc) setlocale (LC_CTYPE, old_lc); #endif + if (rc) + return rc; #ifdef LC_MESSAGES old_lc = setlocale (LC_MESSAGES, NULL); dft_lc = setlocale (LC_MESSAGES, ""); #endif - if (!rc && (opt.lc_messages || (dft_ttyname && dft_lc))) + if (opt.lc_messages || (dft_ttyname && dft_lc)) { char *optstr; if (asprintf (&optstr, "OPTION lc-messages=%s", opt.lc_messages ? opt.lc_messages : dft_lc) < 0) - return GNUPG_Out_Of_Core; - rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL, - NULL); - free (optstr); - if (rc) - return map_assuan_err (rc); + rc = GNUPG_Out_Of_Core; + else + { + rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL, + NULL); + free (optstr); + if (rc) + rc = map_assuan_err (rc); + } } #ifdef LC_MESSAGES if (old_lc) setlocale (LC_MESSAGES, old_lc); #endif - return 0; + return rc; } |