pick: Update from 2.0.1 to 2.0.2
[termux-packages] / ndk-patches / stdio.h.patch
index d9af689..55ab27c 100644 (file)
@@ -1,6 +1,6 @@
 diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/include/stdio.h
---- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h 2017-06-07 01:07:52.000000000 +0200
-+++ ./usr/include/stdio.h      2017-06-18 01:59:17.835984565 +0200
+--- /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h 2017-11-09 09:57:12.000000000 +0100
++++ ./usr/include/stdio.h      2017-11-15 11:57:58.567432093 +0100
 @@ -44,6 +44,9 @@
  #include <stdarg.h>
  #include <stddef.h>
@@ -8,20 +8,20 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
 +#include <string.h>            /* For strcpy(3) used by ctermid() */
 +#include <asm/fcntl.h>         /* For O_RDWR and other O_* constants */
 +
- #define __need_NULL
- #include <stddef.h>
+ #include <bits/seek_constants.h>
  
-@@ -174,7 +178,7 @@
+ #if __ANDROID_API__ < __ANDROID_API_N__
+@@ -167,7 +170,7 @@
      __warnattr_strict("vsprintf is often misused; please use vsnprintf");
- char* tmpnam(char*)
+ char* tmpnam(char* __s)
      __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
 -#define P_tmpdir "/tmp/" /* deprecated */
 +#define P_tmpdir "@TERMUX_PREFIX@/tmp/" /* deprecated */
- char* tempnam(const char*, const char*)
+ char* tempnam(const char* __dir, const char* __prefix)
      __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead");
  
-@@ -239,8 +243,6 @@
  __INTRODUCED_IN(24);
+@@ -242,8 +245,6 @@
FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24);
  #endif /* __ANDROID_API__ >= 24 */
  
 -FILE* tmpfile(void);
@@ -29,31 +29,29 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
  #if __ANDROID_API__ >= 24
  FILE* tmpfile64(void) __INTRODUCED_IN(24);
  #endif /* __ANDROID_API__ >= 24 */
-@@ -256,10 +258,15 @@
+@@ -259,10 +260,15 @@
  
  #define L_ctermid 1024 /* size for ctermid() */
  
 -#if __ANDROID_API__ >= 26
--char* ctermid(char*) __INTRODUCED_IN(26);
+-char* ctermid(char* __buf) __INTRODUCED_IN(26);
 -#endif /* __ANDROID_API__ >= 26 */
-+/* Needed by gnulibs freading() */
++/* Needed by gnulibs freading(). */
 +#define __sferror(p)    (((p)->_flags & __SERR) != 0)
  
-+/* Used by perl, fish, and others */
++/* Used by perl, fish, and others. */
 +static __inline__ char* ctermid(char* s) {
-+    if (s == 0) return (char*) "/dev/tty";
-+    strcpy(s, "/dev/tty");
-+    return s;
++      if (s == 0) return (char*) "/dev/tty";
++      strcpy(s, "/dev/tty");
++      return s;
 +}
  
- FILE* fdopen(int, const char*);
- int fileno(FILE*);
-@@ -577,4 +584,31 @@
- __END_DECLS
+ FILE* fdopen(int __fd, const char* __mode);
+ int fileno(FILE* __fp);
+@@ -310,6 +316,29 @@
+ #include <bits/fortify/stdio.h>
+ #endif
  
-+__BEGIN_DECLS
-+
 +int open(const char*, int, ...) __overloadable __RENAME_CLANG(open);
 +extern pid_t getpid();
 +extern int unlink(const char*);
@@ -65,7 +63,7 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
 +      int i;
 +      for (i = 0; i < 100; i++) {
 +              unsigned int r = arc4random();
-+              if (asprintf(&path, "/data/data/com.termux/files/usr/tmp/tmpfile.%d-%u", p, r) == -1) return NULL;
++              if (asprintf(&path, "@TERMUX_PREFIX@/tmp/tmpfile.%d-%u", p, r) == -1) return NULL;
 +              int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE, 0600);
 +              free(path);
 +              if (fd >= 0) {
@@ -77,6 +75,6 @@ diff -u -r /home/fornwall/lib/android-ndk/sysroot/usr/include/stdio.h ./usr/incl
 +      return NULL;
 +}
 +
-+__END_DECLS
-+
- #endif /* _STDIO_H_ */
+ __END_DECLS
+ #endif