summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2014-10-18 20:03:08 (GMT)
committerdgp <dgp@noemail.net>2014-10-18 20:03:08 (GMT)
commit1960ef9df14cd19d29b8e70a1548bc6cbb77f7e8 (patch)
tree94b624731beb877d48448e3712b4489c15d8f863 /generic
parent281694209261fbc531ba93acdbdde69d980f92db (diff)
parent1bbadd9bf193501e2c019fccee2cb010b1b410a2 (diff)
downloadtcl-1960ef9df14cd19d29b8e70a1548bc6cbb77f7e8.zip
tcl-1960ef9df14cd19d29b8e70a1548bc6cbb77f7e8.tar.gz
tcl-1960ef9df14cd19d29b8e70a1548bc6cbb77f7e8.tar.bz2
[10dc6daa37] New fix for [gets] on non-blocking channel. This time properly accounts for the effects of ENCODING_LINESIZE.
FossilOrigin-Name: 58e5b26f2aaed4bb3602759a3926a2f794ac8481
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 9283bf5..207ce19 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4453,6 +4453,7 @@ Tcl_GetsObj(
eof = NULL;
inEofChar = statePtr->inEofChar;
+ ResetFlag(statePtr, CHANNEL_BLOCKED);
while (1) {
if (dst >= dstEnd) {
if (FilterInputBytes(chanPtr, &gs) != 0) {
@@ -4801,6 +4802,7 @@ TclGetsObjBinary(
eolChar = (statePtr->inputTranslation == TCL_TRANSLATE_LF) ? '\n' : '\r';
+ ResetFlag(statePtr, CHANNEL_BLOCKED);
while (1) {
/*
* Subtract the number of bytes that were removed from channel
@@ -5089,6 +5091,12 @@ FilterInputBytes(
*/
read:
+ if (GotFlag(statePtr, CHANNEL_NONBLOCKING|CHANNEL_BLOCKED)
+ == (CHANNEL_NONBLOCKING|CHANNEL_BLOCKED)) {
+ gsPtr->charsWrote = 0;
+ gsPtr->rawRead = 0;
+ return -1;
+ }
if (GetInput(chanPtr) != 0) {
gsPtr->charsWrote = 0;
gsPtr->rawRead = 0;
@@ -5179,12 +5187,6 @@ FilterInputBytes(
* some more, but avoid blocking on a non-blocking channel.
*/
- if (GotFlag(statePtr, CHANNEL_NONBLOCKING|CHANNEL_BLOCKED)
- == (CHANNEL_NONBLOCKING|CHANNEL_BLOCKED)) {
- gsPtr->charsWrote = 0;
- gsPtr->rawRead = 0;
- return -1;
- }
goto read;
}
} else {