~ chicken-core (chicken-5) 1d21ec81479f93051148059e7becd81f99eacd20


commit 1d21ec81479f93051148059e7becd81f99eacd20
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Oct 20 12:34:45 2014 +0200
Commit:     Mario Domenech Goulart <mario.goulart@gmail.com>
CommitDate: Mon Oct 20 10:38:12 2014 -0200

    Use correct variable when updating buffer-location in "read-buffered" for tcp ports.
    
    Signed-off-by: Mario Domenech Goulart <mario.goulart@gmail.com>

diff --git a/tcp.scm b/tcp.scm
index 99745d0f..1652cbce 100644
--- a/tcp.scm
+++ b/tcp.scm
@@ -359,7 +359,6 @@ EOF
       (let* ((buf (make-string +input-buffer-size+))
 	     (data (vector fd #f #f buf 0))
 	     (buflen 0)
-	     (bufpos 0)
 	     (bufindex 0)
 	     (iclosed #f) 
 	     (oclosed #f)
@@ -469,8 +468,8 @@ EOF
 	       (lambda (p)		; read-buffered
 		 (if (fx>= bufindex buflen)
 		     ""
-		     (let ((str (##sys#substring buf bufpos buflen)))
-		       (set! bufpos buflen)
+		     (let ((str (##sys#substring buf bufindex buflen)))
+		       (set! bufindex buflen)
 		       str)))
 	       ) )
 	     (output
Trap