diff -uNr pinentry-1.1.0/pinentry/pinentry-emacs.c pinentry-1.1.0.mod/pinentry/pinentry-emacs.c
--- pinentry-1.1.0/pinentry/pinentry-emacs.c	2017-12-03 18:13:05.000000000 +0200
+++ pinentry-1.1.0.mod/pinentry/pinentry-emacs.c	2018-10-05 23:01:47.025402891 +0300
@@ -134,7 +134,7 @@
 	}
       else
 #endif
-	tmpdir = "/tmp";
+	tmpdir = "@TERMUX_PREFIX@/tmp";
     }
 
   socket_name_storage = malloc (strlen (tmpdir)
