view sources/patches/uClibc-mkostemp.patch @ 1786:0787ceb820bf draft 1.4.2

When x86-64 switched on NPTL in uClibc, distcc broke, and it turns out fully native compiles under qemu never worked due to qemu not quite emulating floating point right and confusing the perl build with zero not comparing equal to zero. As long as it's broken anyway, switch it over to musl and fix it up on that side. It's no longer worth trying to fix anything broken in uClibc, the project is dead. (I'm aware of uClibc-ng, and am treating it exactly the same way I treated the ecommstation reboot of OS/2.)
author Rob Landley <rob@landley.net>
date Fri, 11 Sep 2015 13:25:14 -0500
parents 1fbfabb09582
children
line wrap: on
line source

diff --git a/include/stdlib.h b/include/stdlib.h
index e9a8b84..b76078c 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -630,16 +630,21 @@ extern char *mktemp (char *__template) __THROW __nonnull ((1)) __wur;
    marked with __THROW.  */
 # ifndef __USE_FILE_OFFSET64
 extern int mkstemp (char *__template) __nonnull ((1)) __wur;
+extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
 # else
 #  ifdef __REDIRECT
 extern int __REDIRECT (mkstemp, (char *__template), mkstemp64)
      __nonnull ((1)) __wur;
+extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
+     __nonnull ((1)) __wur;
 #  else
 #   define mkstemp mkstemp64
+#   define mkostemp mkostemp64
 #  endif
 # endif
 # ifdef __USE_LARGEFILE64
 extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
+extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
 # endif
 #endif
 
diff --git a/libc/stdlib/mkstemp.c b/libc/stdlib/mkstemp.c
index ce7d7db..68581b8 100644
--- a/libc/stdlib/mkstemp.c
+++ b/libc/stdlib/mkstemp.c
@@ -25,7 +25,12 @@
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the filename unique.
    Then open the file and return a fd. */
+int mkostemp (char *template, int flags)
+{
+    return __gen_tempname (template, __GT_FILE, flags);
+}
+
 int mkstemp (char *template)
 {
-    return __gen_tempname (template, __GT_FILE, S_IRUSR | S_IWUSR);
+    return mkostemp(template, S_IRUSR | S_IWUSR);
 }
diff --git a/libc/stdlib/mkstemp64.c b/libc/stdlib/mkstemp64.c
index 2cdee70..375c5d3 100644
--- a/libc/stdlib/mkstemp64.c
+++ b/libc/stdlib/mkstemp64.c
@@ -25,7 +25,12 @@
    The last six characters of TEMPLATE must be "XXXXXX";
    they are replaced with a string that makes the filename unique.
    Then open the file and return a fd. */
+int mkostemp64 (char *template, int flags)
+{
+    return __gen_tempname (template, __GT_BIGFILE, flags);
+}
+
 int mkstemp64 (char *template)
 {
-    return __gen_tempname (template, __GT_BIGFILE, S_IRUSR | S_IWUSR);
+    return mkostemp64 (template, S_IRUSR | S_IWUSR);
 }