1 diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h ./usr/include/stdio.h
2 --- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h 2016-03-03 16:54:24.000000000 -0500
3 +++ ./usr/include/stdio.h 2016-04-11 06:54:22.893930847 -0400
8 +#include <string.h> /* For strcpy(3) used by ctermid() */
9 +#include <asm/fcntl.h> /* For O_RDWR and other O_* constants */
10 +#include <stdlib.h> /* For arc4random() */
17 /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
18 #if __BSD_VISIBLE || __XPG_VISIBLE
19 -#define P_tmpdir "/tmp/"
20 +#define P_tmpdir "@TERMUX_PREFIX@/tmp/"
22 #define L_tmpnam 1024 /* XXX must be == PATH_MAX */
23 #define TMP_MAX 308915776
25 int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
26 int sscanf(const char * __restrict, const char * __restrict, ...)
29 int ungetc(int, FILE *);
30 int vfprintf(FILE * __restrict, const char * __restrict, __va_list)
33 #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
34 #endif /* __BSD_VISIBLE */
36 +/* Needed by gnulibs freading() */
37 +#define __sferror(p) (((p)->_flags & __SERR) != 0)
39 +/* Used by perl, fish, and others */
40 +static __inline__ char* ctermid(char* s) {
41 + if (s == 0) return (char*) "/dev/tty";
42 + strcpy(s, "/dev/tty");
46 #if defined(__BIONIC_FORTIFY)
51 #endif /* defined(__BIONIC_FORTIFY) */
55 +extern int open(const char*, int, ...);
56 +extern pid_t getpid();
57 +extern int unlink(const char*);
58 +static __inline__ FILE* tmpfile() {
62 + for (i = 0; i < 100; i++) {
63 + unsigned int r = arc4random();
64 + if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%u", p, r) == -1) return NULL;
65 + int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600);
68 + FILE* result = fdopen(fd, "w+");
78 #endif /* _STDIO_H_ */