mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 04:15:36 +02:00
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
This commit is contained in:
parent
08926cdcd0
commit
a5df94e78c
2 changed files with 19 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue