aboutsummaryrefslogtreecommitdiffstats
path: root/src/ttyname_r.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2012-10-24 14:44:34 +0000
committerWerner Koch <[email protected]>2012-10-24 14:44:34 +0000
commit12a0c93433a0b1d7e8019fc35a63476db39327fa (patch)
tree1eb1f8d10bac5f07d3e31c4aa58434e62de8935e /src/ttyname_r.c
parenttests: Adhere to the docs and call gpgme_check_version. (diff)
downloadgpgme-12a0c93433a0b1d7e8019fc35a63476db39327fa.tar.gz
gpgme-12a0c93433a0b1d7e8019fc35a63476db39327fa.zip
Fix ttyname problem on Android.
* configure.ac: Define macro and conditional HAVE_ANDROID_SYSTEM. * m4/gnupg-ttyname.m4: Force use of replacement on Android. * src/ttyname_r.c: Ditto. -- Android's bionic lib has no working ttyname_r() nor ttyname(). Using them anyway will print FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:466 Thus we force the use of our replacement code which simply return "/dev/tty".
Diffstat (limited to 'src/ttyname_r.c')
-rw-r--r--src/ttyname_r.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ttyname_r.c b/src/ttyname_r.c
index 105e0af5..eed28bd7 100644
--- a/src/ttyname_r.c
+++ b/src/ttyname_r.c
@@ -32,6 +32,12 @@
# warning ttyname is not thread-safe, and ttyname_r is missing
#endif
+/* For Android we force the use of our replacement code. */
+#if HAVE_ANDROID_SYSTEM
+# undef HAVE_TTYNAME_R
+#endif
+
+
int
_gpgme_ttyname_r (int fd, char *buf, size_t buflen)
{
@@ -110,12 +116,11 @@ _gpgme_ttyname_r (int fd, char *buf, size_t buflen)
#else /*!HAVE_TTYNAME_R*/
char *tty;
-# if HAVE_W32_SYSTEM
+# if HAVE_W32_SYSTEM || HAVE_ANDROID_SYSTEM
/* We use this default one for now. AFAICS we only need it to be
passed to gpg and in turn to pinentry. Providing a replacement
- is needed because elsewhere we bail out on error. If we
- eventually implement a pinentry for Windows it is inlikely that
- we need a real tty at all. */
+ is needed because elsewhere we bail out on error or Android
+ provided ttyname_r prints an error message if used. */
tty = "/dev/tty";
# else
tty = ttyname (fd);