2015-06-13 01:03:31 +02:00
|
|
|
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h ./usr/include/stdio.h
|
2016-04-11 13:11:39 +02:00
|
|
|
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/stdio.h 2016-03-03 16:54:24.000000000 -0500
|
|
|
|
+++ ./usr/include/stdio.h 2016-04-11 06:54:22.893930847 -0400
|
|
|
|
@@ -52,6 +52,10 @@
|
2015-12-24 09:20:05 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
+#include <string.h> /* For strcpy(3) used by ctermid() */
|
2016-04-11 15:15:57 +02:00
|
|
|
+#include <asm-generic/fcntl.h> /* For O_RDWR and other O_* constants */
|
2016-04-11 13:22:10 +02:00
|
|
|
+#include <stdlib.h> /* For arc4random() */
|
2015-12-24 09:20:05 +01:00
|
|
|
+
|
|
|
|
#define __need_NULL
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2016-04-11 13:11:39 +02:00
|
|
|
@@ -193,7 +196,7 @@
|
2015-12-24 09:20:05 +01:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
|
|
|
|
#if __BSD_VISIBLE || __XPG_VISIBLE
|
|
|
|
-#define P_tmpdir "/tmp/"
|
2015-12-24 09:21:22 +01:00
|
|
|
+#define P_tmpdir "@TERMUX_PREFIX@/tmp/"
|
2015-06-13 01:03:31 +02:00
|
|
|
#endif
|
|
|
|
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
|
|
|
|
#define TMP_MAX 308915776
|
2016-04-11 13:11:39 +02:00
|
|
|
@@ -257,7 +260,6 @@
|
|
|
|
int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
|
|
|
|
int sscanf(const char * __restrict, const char * __restrict, ...)
|
|
|
|
__scanflike(2, 3);
|
|
|
|
-FILE *tmpfile(void);
|
|
|
|
int ungetc(int, FILE *);
|
|
|
|
int vfprintf(FILE * __restrict, const char * __restrict, __va_list)
|
|
|
|
__printflike(2, 0);
|
2015-12-24 09:20:05 +01:00
|
|
|
@@ -371,6 +373,16 @@
|
2015-06-13 01:03:31 +02:00
|
|
|
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
|
|
|
|
#endif /* __BSD_VISIBLE */
|
2015-12-24 09:20:05 +01:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
+/* Needed by gnulibs freading() */
|
|
|
|
+#define __sferror(p) (((p)->_flags & __SERR) != 0)
|
2015-12-24 08:04:00 +01:00
|
|
|
+
|
|
|
|
+/* Used by perl, fish, and others */
|
|
|
|
+static char* ctermid(char* s) {
|
2016-04-29 02:39:29 +02:00
|
|
|
+ if (s == 0) return (char*) "/dev/tty";
|
2015-12-24 08:04:00 +01:00
|
|
|
+ strcpy(s, "/dev/tty");
|
|
|
|
+ return s;
|
|
|
|
+}
|
2015-06-13 01:03:31 +02:00
|
|
|
+
|
|
|
|
#if defined(__BIONIC_FORTIFY)
|
2015-12-24 09:20:05 +01:00
|
|
|
|
2015-06-13 01:03:31 +02:00
|
|
|
__BEGIN_DECLS
|
2016-04-11 15:15:57 +02:00
|
|
|
@@ -462,4 +474,29 @@
|
2016-04-11 13:11:39 +02:00
|
|
|
|
|
|
|
#endif /* defined(__BIONIC_FORTIFY) */
|
|
|
|
|
|
|
|
+__BEGIN_DECLS
|
|
|
|
+
|
2016-04-11 15:15:57 +02:00
|
|
|
+extern int open(const char*, int, ...);
|
|
|
|
+extern pid_t getpid();
|
|
|
|
+extern int unlink(const char*);
|
2016-04-11 13:11:39 +02:00
|
|
|
+static FILE* tmpfile() {
|
|
|
|
+ int p = getpid();
|
|
|
|
+ char* path;
|
|
|
|
+ int i;
|
|
|
|
+ for (i = 0; i < 100; i++) {
|
2016-04-11 13:22:10 +02:00
|
|
|
+ unsigned int r = arc4random();
|
|
|
|
+ if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%u", p, r) == -1) return NULL;
|
2016-04-11 13:11:39 +02:00
|
|
|
+ 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_ */
|