mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
* call-agent.c (start_agent): Fix error handling logic so the locale is always correctly reset.
This commit is contained in:
parent
898dda02e4
commit
b107b6d795
@ -1,3 +1,8 @@
|
|||||||
|
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
|
* call-agent.c (start_agent): Fix error handling logic so the
|
||||||
|
locale is always correctly reset.
|
||||||
|
|
||||||
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
|
2002-04-25 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* server.c (option_handler): Accept display, ttyname, ttytype,
|
* server.c (option_handler): Accept display, ttyname, ttytype,
|
||||||
|
@ -132,7 +132,7 @@ get_membuf (struct membuf *mb, size_t *len)
|
|||||||
static int
|
static int
|
||||||
start_agent (void)
|
start_agent (void)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc = 0;
|
||||||
char *infostr, *p;
|
char *infostr, *p;
|
||||||
ASSUAN_CONTEXT ctx;
|
ASSUAN_CONTEXT ctx;
|
||||||
char *dft_display = NULL;
|
char *dft_display = NULL;
|
||||||
@ -252,7 +252,7 @@ start_agent (void)
|
|||||||
return map_assuan_err (rc);
|
return map_assuan_err (rc);
|
||||||
}
|
}
|
||||||
dft_ttytype = getenv ("TERM");
|
dft_ttytype = getenv ("TERM");
|
||||||
if (!rc && (opt.ttytype || (dft_ttyname && dft_ttytype)))
|
if (opt.ttytype || (dft_ttyname && dft_ttytype))
|
||||||
{
|
{
|
||||||
char *optstr;
|
char *optstr;
|
||||||
if (asprintf (&optstr, "OPTION ttytype=%s",
|
if (asprintf (&optstr, "OPTION ttytype=%s",
|
||||||
@ -268,44 +268,52 @@ start_agent (void)
|
|||||||
old_lc = setlocale (LC_CTYPE, NULL);
|
old_lc = setlocale (LC_CTYPE, NULL);
|
||||||
dft_lc = setlocale (LC_CTYPE, "");
|
dft_lc = setlocale (LC_CTYPE, "");
|
||||||
#endif
|
#endif
|
||||||
if (!rc && (opt.lc_ctype || (dft_ttyname && dft_lc)))
|
if (opt.lc_ctype || (dft_ttyname && dft_lc))
|
||||||
{
|
{
|
||||||
char *optstr;
|
char *optstr;
|
||||||
if (asprintf (&optstr, "OPTION lc-ctype=%s",
|
if (asprintf (&optstr, "OPTION lc-ctype=%s",
|
||||||
opt.lc_ctype ? opt.lc_ctype : dft_lc) < 0)
|
opt.lc_ctype ? opt.lc_ctype : dft_lc) < 0)
|
||||||
return GNUPG_Out_Of_Core;
|
rc = GNUPG_Out_Of_Core;
|
||||||
|
else
|
||||||
|
{
|
||||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
free (optstr);
|
free (optstr);
|
||||||
if (rc)
|
if (rc)
|
||||||
return map_assuan_err (rc);
|
rc = map_assuan_err (rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef LC_CTYPE
|
#ifdef LC_CTYPE
|
||||||
if (old_lc)
|
if (old_lc)
|
||||||
setlocale (LC_CTYPE, old_lc);
|
setlocale (LC_CTYPE, old_lc);
|
||||||
#endif
|
#endif
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
#ifdef LC_MESSAGES
|
#ifdef LC_MESSAGES
|
||||||
old_lc = setlocale (LC_MESSAGES, NULL);
|
old_lc = setlocale (LC_MESSAGES, NULL);
|
||||||
dft_lc = setlocale (LC_MESSAGES, "");
|
dft_lc = setlocale (LC_MESSAGES, "");
|
||||||
#endif
|
#endif
|
||||||
if (!rc && (opt.lc_messages || (dft_ttyname && dft_lc)))
|
if (opt.lc_messages || (dft_ttyname && dft_lc))
|
||||||
{
|
{
|
||||||
char *optstr;
|
char *optstr;
|
||||||
if (asprintf (&optstr, "OPTION lc-messages=%s",
|
if (asprintf (&optstr, "OPTION lc-messages=%s",
|
||||||
opt.lc_messages ? opt.lc_messages : dft_lc) < 0)
|
opt.lc_messages ? opt.lc_messages : dft_lc) < 0)
|
||||||
return GNUPG_Out_Of_Core;
|
rc = GNUPG_Out_Of_Core;
|
||||||
|
else
|
||||||
|
{
|
||||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
free (optstr);
|
free (optstr);
|
||||||
if (rc)
|
if (rc)
|
||||||
return map_assuan_err (rc);
|
rc = map_assuan_err (rc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef LC_MESSAGES
|
#ifdef LC_MESSAGES
|
||||||
if (old_lc)
|
if (old_lc)
|
||||||
setlocale (LC_MESSAGES, old_lc);
|
setlocale (LC_MESSAGES, old_lc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user