diff -uNr mandoc-1.14.3/mandocdb.c mandoc-1.14.3.mod/mandocdb.c
--- mandoc-1.14.3/mandocdb.c	2017-08-05 15:40:22.000000000 +0300
+++ mandoc-1.14.3.mod/mandocdb.c	2017-09-14 14:33:07.342860405 +0300
@@ -2154,7 +2154,7 @@
 	 * file, but let's at least check whether the data changed.
 	 */
 
-	(void)strlcpy(tfn, "/tmp/mandocdb.XXXXXXXX", sizeof(tfn));
+	(void)strlcpy(tfn, "@TERMUX_PREFIX@/tmp/mandocdb.XXXXXXXX", sizeof(tfn));
 	if (mkdtemp(tfn) == NULL) {
 		exitcode = (int)MANDOCLEVEL_SYSERR;
 		say("", "&%s", tfn);
