mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +01:00
(setup_pinentry_env): Try hard to set a default for GPG_TTY.
This commit is contained in:
parent
31cdfcafe4
commit
ad5d5fce4f
@ -1,3 +1,7 @@
|
|||||||
|
2004-10-04 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* misc.c (setup_pinentry_env): Try hard to set a default for GPG_TTY.
|
||||||
|
|
||||||
2004-09-30 Werner Koch <wk@g10code.com>
|
2004-09-30 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpgsm.c (i18n_init): Always use LC_ALL.
|
* gpgsm.c (i18n_init): Always use LC_ALL.
|
||||||
|
17
sm/misc.c
17
sm/misc.c
@ -30,7 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gpgsm.h"
|
#include "gpgsm.h"
|
||||||
|
#include "i18n.h"
|
||||||
|
|
||||||
/* Setup the environment so that the pinentry is able to get all
|
/* Setup the environment so that the pinentry is able to get all
|
||||||
required information. This is used prior to an exec of the
|
required information. This is used prior to an exec of the
|
||||||
@ -42,8 +42,23 @@ setup_pinentry_env (void)
|
|||||||
|
|
||||||
if (opt.display)
|
if (opt.display)
|
||||||
setenv ("DISPLAY", opt.display, 1);
|
setenv ("DISPLAY", opt.display, 1);
|
||||||
|
|
||||||
|
/* Try to make sure that GPG_TTY has been set. This is needed if we
|
||||||
|
call for example the protect-tools with redirected stdin and thus
|
||||||
|
it won't be able to ge a default by itself. Try to do it here
|
||||||
|
but print a warning. */
|
||||||
if (opt.ttyname)
|
if (opt.ttyname)
|
||||||
setenv ("GPG_TTY", opt.ttyname, 1);
|
setenv ("GPG_TTY", opt.ttyname, 1);
|
||||||
|
else if (!(lc=getenv ("GPG_TTY")) || !*lc)
|
||||||
|
{
|
||||||
|
log_error (_("GPG_TTY has not been set - "
|
||||||
|
"using maybe bogus default\n"));
|
||||||
|
lc = ttyname (0);
|
||||||
|
if (!lc)
|
||||||
|
lc = "/dev/tty";
|
||||||
|
setenv ("GPG_TTY", lc, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (opt.ttytype)
|
if (opt.ttytype)
|
||||||
setenv ("TERM", opt.ttytype, 1);
|
setenv ("TERM", opt.ttytype, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user