summaryrefslogtreecommitdiff
path: root/test-suite/tests/posix.test
diff options
context:
space:
mode:
authorMike Gran <spk121@yahoo.com>2019-02-09 16:59:38 -0800
committerAndy Wingo <wingo@pobox.com>2019-05-23 17:30:33 +0200
commita5df94e78c3aaed257c9b8dbaafff28cf506cca8 (patch)
treef040bfd6df774af96940fd045149b9b723b0b8ec /test-suite/tests/posix.test
parent08926cdcd092c741f7fac726c70fff8f178daeea (diff)
downloadguile-a5df94e78c3aaed257c9b8dbaafff28cf506cca8.tar.gz
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/tests/posix.test')
-rw-r--r--test-suite/tests/posix.test17
1 files changed, 16 insertions, 1 deletions
diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test
index aa1605a6b..aa0dbc1b2 100644
--- a/test-suite/tests/posix.test
+++ b/test-suite/tests/posix.test
@@ -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