io: fix 'update mode to not create a file

This commit is contained in:
Matthew Flatt 2019-01-24 19:30:29 -07:00
parent 6c435abaa7
commit 77e362b27c
2 changed files with 7 additions and 2 deletions

View File

@ -334,6 +334,11 @@
(define tempfilename (make-temporary-file))
(when (file-exists? tempfilename)
(delete-file tempfilename))
(err/rt-test (open-output-file tempfilename #:exists 'update) exn:fail:filesystem?)
(test #t output-port? (open-output-file tempfilename #:exists 'can-update))
(delete-file tempfilename)
(let ([p (open-output-file tempfilename)])
(err/rt-test (write-special 'foo p) exn:application:mismatch?)
(test #t integer? (port-file-identity p))

View File

@ -63,8 +63,8 @@
RKTIO_OPEN_CAN_EXIST)]
[(must-truncate) (+ RKTIO_OPEN_TRUNCATE
RKTIO_OPEN_MUST_EXIST)]
[(update) RKTIO_OPEN_CAN_EXIST]
[(must-update) RKTIO_OPEN_MUST_EXIST]
[(can-update) RKTIO_OPEN_CAN_EXIST]
[(update) RKTIO_OPEN_MUST_EXIST]
[(append) RKTIO_OPEN_APPEND]
[else 0]))
(define (mode? v)