summaryrefslogtreecommitdiff
path: root/libguile/filesys.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-01-08 23:25:27 +0100
committerAndy Wingo <wingo@pobox.com>2017-01-08 23:25:56 +0100
commit6ff1ec9c31fadbcf5cfe3d4837b8fad62c1bcb27 (patch)
tree73be176ddf41a658a6c9bb40f4b1254d6db7809e /libguile/filesys.c
parentb392d81c9ca0bec82b43ca49e8cf96c0e9460a89 (diff)
downloadguile-6ff1ec9c31fadbcf5cfe3d4837b8fad62c1bcb27.tar.gz
Fix mkstemp on macOS
* libguile/filesys.c (scm_i_mkstemp): Limit flags to mkostemp. Based on a patch by Matt Wette; thanks!
Diffstat (limited to 'libguile/filesys.c')
-rw-r--r--libguile/filesys.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libguile/filesys.c b/libguile/filesys.c
index cccb39787..ae164fe83 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);
}