ttyname in gpgme when running Android

Werner Koch wk at
Tue Dec 11 16:08:42 CET 2012

On Tue, 11 Dec 2012 15:29, abel at said:

> In function `session_env_getenv_or_default':
> ~src/guardian/gnupg-for-android/external/gnupg/common/session-env.c:341:
> undefined reference to `broken_native_ttyname'

I can't see and reference to that symbol.  May it be that there is some
cruft from an older patch?

> On android we want to avoid the ttyname code all together (presumably
> like W32 does?).

That is what the commit does.  It defines HAVE_BROKEN_TTYNAME and in
util.h we use:

  #if !defined(HAVE_TTYNAME) || defined(HAVE_BROKEN_TTYNAME)
  # define gnupg_ttyname(n) _gnupg_ttyname ((n))
  /* Systems without ttyname (W32) will merely return NULL. */
  static inline char *
  _gnupg_ttyname (int fd)
    return NULL;
  #else /*HAVE_TTYNAME*/
  # define gnupg_ttyname(n) ttyname ((n))
  #endif /*HAVE_TTYNAME */

On Windows HAVE_TTYNAME is not defined and on Android
HAVE_BROKEN_TTYNAME is defined.  Thus the macro and the inline function
is used.
> In gpgme we the REPLACE_TTYNAME magic from gpgme/m4/gnupg-ttyname.m4
> needs to be ported to gnupg as well.

That was too different from what we use in GnuPG.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gnupg-devel mailing list