summaryrefslogtreecommitdiffstats
path: root/common/session-env.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2012-11-20 19:01:13 +0100
committerWerner Koch <wk@gnupg.org>2012-11-20 19:03:49 +0100
commit835698b72bc509565aad52b0753f1c56c1a8f062 (patch)
treedd5352b45d74cb3ef4b3091dcc16824ce57e4991 /common/session-env.c
parentFix non-portable use of chmod in autogen.sh. (diff)
downloadgnupg2-835698b72bc509565aad52b0753f1c56c1a8f062.tar.xz
gnupg2-835698b72bc509565aad52b0753f1c56c1a8f062.zip
Do not use a broken ttyname.
* configure.ac (HAVE_BROKEN_TTYNAME): New ac_define set for Android systems. * common/util.h (gnupg_ttyname): New macro. Change all callers of ttyname to use this macro instead. (ttyname) [W32]: Rename to _gnupg_ttyname and use also if HAVE_BROKEN_TTYNAME is defined. * common/simple-pwquery.c (agent_send_all_options): Keep on using ttyname unless HAVE_BROKEN_TTYNAME is set. This is because this file may be used standalone.
Diffstat (limited to 'common/session-env.c')
-rw-r--r--common/session-env.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/session-env.c b/common/session-env.c
index ff9044732..478d5e3be 100644
--- a/common/session-env.c
+++ b/common/session-env.c
@@ -338,8 +338,11 @@ session_env_getenv_or_default (session_env_t se, const char *name,
/* Get the default value with an additional fallback for GPG_TTY. */
defvalue = getenv (name);
- if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY") && ttyname (0))
- defvalue = ttyname (0);
+ if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY")
+ && gnupg_ttyname (0))
+ {
+ defvalue = gnupg_ttyname (0);
+ }
if (defvalue)
{
/* Record the default value for later use so that we are safe