Hi all,

This commit http://gcc.gnu.org/ml/gcc-cvs/2013-11/msg00376.html
uses the mkostemp function call. On FreeBSD 10.0 and up we have this
function too. But the function denies to accept other flags than the
ones mentioned in the man page.

From:
http://www.freebsd.org/cgi/man.cgi?query=mktemp&apropos=0&sektion=3&manpath=FreeBSD+10-current&format=html
---
The mkostemp() function is like mkstemp() but allows specifying addi-
tional open(2) flags (defined in <fcntl.h>).  The permitted flags are
O_APPEND, O_DIRECT, O_SHLOCK, O_EXLOCK, O_SYNC and O_CLOEXEC.
---

So, currently the Fortran Runtime gives an error telling me about an
'invalid argument'.

The below patch allows me to get back to normal, means zero unexpected
fails, on FreeBSD. The patch has been tested on Linux/x86 as well, no
regressions.

Janne already approved this patch and I'm going to commit it in the next
24 hours.

Thanks,
Andreas

2013-12-17  Andreas Tobler  <andre...@gcc.gnu.org>

        * io/unix.c (tempfile_open): Only use the needed flag O_CLOEXEC.


Index: io/unix.c
===================================================================
--- io/unix.c   (revision 206039)
+++ io/unix.c   (working copy)
@@ -1124,7 +1124,7 @@
 #endif

 #if defined(HAVE_MKOSTEMP) && defined(O_CLOEXEC)
-  fd = mkostemp (template, O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC);
+  fd = mkostemp (template, O_CLOEXEC);
 #else
   fd = mkstemp (template);
   set_close_on_exec (fd);

Reply via email to