1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

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.
This commit is contained in:
Werner Koch 2012-11-20 19:01:13 +01:00
parent e7bc5012c5
commit 835698b72b
6 changed files with 24 additions and 9 deletions

View file

@ -291,15 +291,21 @@ int gnupg_compare_version (const char *a, const char *b);
/*-- Simple replacement functions. */
#ifndef HAVE_TTYNAME
/* We use the gnupg_ttyname macro to be safe not to run into conflicts
which an extisting but broken ttyname. */
#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 *
ttyname (int fd)
_gnupg_ttyname (int fd)
{
(void)fd;
return NULL;
}
#endif /* !HAVE_TTYNAME */
#else /*HAVE_TTYNAME*/
# define gnupg_ttyname(n) ttyname ((n))
#endif /*HAVE_TTYNAME */
#ifdef HAVE_W32CE_SYSTEM
#define getpid() GetCurrentProcessId ()