rktio Windows: fix truncate-file to not move file position

A call intended to restore the position was in place, but it
was wrong.
This commit is contained in:
Matthew Flatt 2018-11-12 09:37:02 -08:00
parent 8e4cecf215
commit 9e4ebd9196
2 changed files with 3 additions and 1 deletions

View File

@ -454,7 +454,9 @@
(close-output-port o))
(test 900 file-size tempfilename)
(let ([o (open-output-file tempfilename #:exists 'update)])
(file-position o 10)
(file-truncate o 399)
(test 10 file-position o)
(close-output-port o))
(test 399 file-size tempfilename)

View File

@ -360,7 +360,7 @@ rktio_ok_t rktio_set_file_size(rktio_t *rktio, rktio_fd_t *rfd, rktio_filesize_t
} else {
if (SetEndOfFile((HANDLE)fd)) {
/* we assume that this works: */
(void)SetFilePointer((HANDLE)fd, lo_w, &hi_w, FILE_BEGIN);
(void)SetFilePointer((HANDLE)fd, old_lo_w, &old_hi_w, FILE_BEGIN);
return 1;
}
get_windows_error();