~ chicken-core (master) 3c1bad28e3be12fe4008b074f5a772a43d6aa95f


commit 3c1bad28e3be12fe4008b074f5a772a43d6aa95f
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Thu Oct 15 13:51:29 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Thu Oct 15 13:51:29 2026 +0200

    reference was circular, implement directly

diff --git a/port.scm b/port.scm
index 85ce57a5..7c85c0bb 100644
--- a/port.scm
+++ b/port.scm
@@ -410,7 +410,12 @@ char *ttyname(int fd) {
                                   (let ((m (insert dest start x)))
                                     (loop (and n (fx- n m)) (fx+ c m))))))))))
 	     read-line			; read-line
-	     ##sys#read-buffered-bytes     ; read-buffered
+	     (lambda (p)      ; read-buffered
+               (if peek-char
+                   (let ((last (##sys#slot p 10)))
+                     (##sys#setislot p 10 #f)
+                     (string last))
+                   ""))
              (lambda (p) (ready?))  ; char-ready?
              ))
 	   (data (vector #f))
Trap