guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/04: Fix mkstemp on macOS


From: Andy Wingo
Subject: [Guile-commits] 01/04: Fix mkstemp on macOS
Date: Sun, 8 Jan 2017 22:50:31 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit 6ff1ec9c31fadbcf5cfe3d4837b8fad62c1bcb27
Author: Andy Wingo <address@hidden>
Date:   Sun Jan 8 23:25:27 2017 +0100

    Fix mkstemp on macOS
    
    * libguile/filesys.c (scm_i_mkstemp): Limit flags to mkostemp.  Based on
      a patch by Matt Wette; thanks!
---
 libguile/filesys.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libguile/filesys.c b/libguile/filesys.c
index cccb397..ae164fe 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1489,6 +1489,12 @@ SCM_DEFINE (scm_i_mkstemp, "mkstemp!", 1, 1, 0,
   else
     {
       open_flags = scm_i_mode_to_open_flags (mode, &is_binary, FUNC_NAME);
+      /* mkostemp(2) only defines O_APPEND, O_SYNC, and O_CLOEXEC to be
+         useful, as O_RDWR|O_CREAT|O_EXCL are implicitly added.  It also
+         notes that other flags may error on some systems, which turns
+         out to be the case.  Of those flags, O_APPEND is the only one
+         of interest anyway, so limit to that flag.  */
+      open_flags &= O_APPEND;
       mode_bits = scm_i_mode_bits (mode);
     }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]