···11+Filter incompat. mkostemp(3) flags on macOS 10.12
22+33+macOS Sierra introduces a mkostemp(3) function which is used when
44+present. Contrary to the GNUlib version of mkostemp(3) that was used
55+previously, this version fails with 'invalid argument' when flags other
66+than from a specified set are passed. From mktemp(3):
77+88+| The mkostemp() function is like mkstemp() but allows specifying
99+| additional open(2) flags (defined in <fcntl.h>). The permitted flags
1010+| are O_APPEND, O_SHLOCK, O_EXLOCK and O_CLOEXEC.
1111+1212+Signed-off-by: Clemens Lang <cal@macports.org>
1313+Upstream-Status: Submitted [https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24862#23]
1414+--- a/libguile/filesys.c.orig 2017-01-09 00:53:27.000000000 +0100
1515++++ b/libguile/filesys.c 2017-01-09 00:54:48.000000000 +0100
1616+@@ -1486,6 +1486,12 @@
1717+ mode_bits = scm_i_mode_bits (mode);
1818+ }
1919+2020++#ifdef __APPLE__
2121++ /* macOS starting with 10.12 defines mkostemp(2) which is used if defined,
2222++ * but only accepts some flags according to its manpage. It fails with
2323++ * invalid argument when other flags are passed. */
2424++ open_flags &= O_APPEND | O_SHLOCK | O_EXLOCK | O_CLOEXEC;
2525++#endif
2626+ SCM_SYSCALL (rv = mkostemp (c_tmpl, open_flags));
2727+ if (rv == -1)
2828+ SCM_SYSERROR;