--- a/diffstat.c
+++ b/diffstat.c
@@ -3142,7 +3142,7 @@ copy_stdin(char **dirpath)
     const char *tmp = getenv("TMPDIR");
     char *result = 0;
     if (tmp == 0)
-	tmp = "/tmp/";
+	tmp = "@TERMUX_PREFIX@/tmp/";
     *dirpath = xmalloc(strlen(tmp) + 12);
 
     strcpy(*dirpath, tmp);
