diff options
author | Mike Gran <spk121@yahoo.com> | 2019-02-09 16:59:38 -0800 |
---|---|---|
committer | Mike Gran <spk121@yahoo.com> | 2019-02-09 16:59:38 -0800 |
commit | 78468baa118d316050a27e43250966e52ffd3d54 (patch) | |
tree | 872501b436bf0e10b1bcd2f6ef2d7aab63cbfaef /test-suite | |
parent | 1437b76777e576b3d000e2f80c5ecdb33a74ac33 (diff) |
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
Diffstat (limited to 'test-suite')
-rw-r--r-- | test-suite/tests/posix.test | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index 63b451397..d3170c743 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -1,7 +1,7 @@ ;;;; posix.test --- Test suite for Guile POSIX functions. -*- scheme -*- ;;;; ;;;; Copyright 2003, 2004, 2006, 2007, 2010, 2012, -;;;; 2015, 2017, 2018 Free Software Foundation, Inc. +;;;; 2015, 2017, 2018, 2019 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -76,7 +76,22 @@ (result (not (string=? str template)))) (close-port port) (delete-file str) - result))) + result)) + + (pass-if "binary mode honored" + (let* ((template "T-XXXXXX") + (str (string-copy template)) + (outport (mkstemp! str "wb"))) + (display "\n" outport) + (close-port outport) + (let* ((inport (open-input-file str #:binary #t)) + (char1 (read-char inport)) + (char2 (read-char inport)) + (result (and (char=? char1 #\newline) + (eof-object? char2)))) + (close-port inport) + (delete-file str) + result)))) ;; ;; putenv |