+@@ -462,4 +474,26 @@
+
+ #endif /* defined(__BIONIC_FORTIFY) */
+
++__BEGIN_DECLS
++
++static FILE* tmpfile() {
++ int p = getpid();
++ char* path;
++ int i;
++ for (i = 0; i < 100; i++) {
++ long int r = random();
++ if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%l", p, r) == -1) return NULL;
++ int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE);
++ free(path);
++ if (fd >= 0) {
++ FILE* result = fdopen(fd, "w+");
++ unlink(path);
++ return result;
++ }
++ }
++ return NULL;
++}
++
++__END_DECLS
++
+ #endif /* _STDIO_H_ */