Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#14 Fix for coping with 0 from Tcl_ReadChars()

open
nobody
None
5
2011-10-12
2011-10-12
Anonymous
No

Tcl_ReadChars() is a nonblocking function and may return 0 even if select(2)
indicated some data was available. Cope with this by explicitly checking for
EOF if Tcl_ReadChars() returned 0.

Interestingly, this makes the comment immediately preceding the test accurate
once more.

To trigger the failure this patch fixes easily, run with a multi-byte locale (e.g.
en_GB.UTF-8) and over a pty/serial port/etc., send a single octet of a valid
multi-byte character (e.g. 0xE0).

Whilst I generated this patch against 5.44.1.15 it applies fine against 5.45 and
a visual inspection shows all is well.

Discussion