Hello, Andy Wingo skribis: > There are tabs in your code; would you mind doing only spaces? > > A port being unbuffered doesn't mean that it has no bytes in its > buffer. In particular, scm_unget_bytes may put bytes back into the > buffer. Or, peek-u8 might fill this buffer with one byte. > > Also, they port may have buffered write bytes (could be the port has > write buffering but no read buffering). In that case (pt->rw_random) > you need to scm_flush(). > > I suggest taking the buffered bytes from the read buffer, if any. Then > if the port is unbuffered, make a bytevector and call scm_i_read_bytes; > otherwise do the scm_fill_input path that's there already. > > One more thing, if the port goes EOF, you need to > scm_port_buffer_set_has_eof_p. I think the attached patch addresses these issues. WDYT? Thanks for the review! Ludo’.