diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index bf3bc4295..b143f7475 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -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) diff --git a/tests/tmpfile.pure.lisp b/tests/tmpfile.pure.lisp index 6f29fe15e..a463e9fd8 100644 --- a/tests/tmpfile.pure.lisp +++ b/tests/tmpfile.pure.lisp @@ -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))