From a5df94e78c3aaed257c9b8dbaafff28cf506cca8 Mon Sep 17 00:00:00 2001 From: Mike Gran Date: Sat, 9 Feb 2019 16:59:38 -0800 Subject: Fix binary output on files created by mkstemp! Some operating systems require a O_BINARY flag. * libguile/filesys.c (scm_i_mkstemp): Don't mask out O_BINARY flag * test-suite/tests/posix.test ("binary mode honored"): new test --- libguile/filesys.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libguile/filesys.c') diff --git a/libguile/filesys.c b/libguile/filesys.c index 113cf784b..ccec10b8b 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -1513,9 +1513,9 @@ SCM_DEFINE (scm_i_mkstemp, "mkstemp!", 1, 1, 0, /* 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; + out to be the case. Of those flags, O_APPEND and O_BINARY are + the only ones of interest anyway, so limit to those flags. */ + open_flags &= O_APPEND | O_BINARY; mode_bits = scm_i_mode_bits (mode); } -- cgit v1.2.3