mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Fix :file-length method of stream-from-stdio-file
It positioned the stream to 0 by accident
This commit is contained in:
parent
36c3659322
commit
2063bcf9a3
|
|
@ -2857,7 +2857,7 @@
|
|||
(:file-length
|
||||
;; there are at least 2 ways to do this: stat() or lseek() a few times
|
||||
(let* ((fd (stdio-file-fd stdio-file))
|
||||
(cur (sb-unix:unix-lseek fd 0 sb-unix:L_SET)) ; SEEK-SET
|
||||
(cur (sb-unix:unix-lseek fd 0 sb-unix:L_INCR)) ; SEEK-CUR
|
||||
(end (sb-unix:unix-lseek fd 0 sb-unix:L_XTND))) ; SEEK-END
|
||||
;; go back to where it was
|
||||
(sb-unix:unix-lseek fd cur sb-unix:L_SET)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
(multiple-value-bind (output warn err)
|
||||
(sb-c:compile-form-to-file '(progn (defvar *foo* 3)) tmpfile)
|
||||
(assert (and output (not warn) (not err)))
|
||||
(assert (eq (sb-int:info :variable :kind '*foo*) :special))
|
||||
(sb-int:clear-info :variable :kind '*foo*)
|
||||
(let ((stream (sb-impl::stream-from-stdio-file tmpfile :input t)))
|
||||
;; compile-form-to-file leaves the file positioned to its end.
|
||||
(file-position stream 0)
|
||||
(sb-fasl::load-as-fasl stream nil nil)
|
||||
(sb-unix:unix-fclose tmpfile)
|
||||
(assert (eq (sb-int:info :variable :kind '*foo*) :special))
|
||||
|
|
|
|||
Loading…
Reference in a new issue