On Tue, Dec 17, 2013 at 06:19:43AM +0100, Andreas Tobler wrote: > 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.
On Linux, mkostemp performs on flags: (flags & ~O_ACCMODE) | O_RDWR | O_CREAT | O_EXCL before passing it to open(2), so the patch makes no real change on Linux. > 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); Jakub