summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-10-17 15:30:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-10-17 15:30:21 (GMT)
commit1a3088ac3379f8ef5645a6fb601ed55a99c3870b (patch)
tree1a51cd19fa9faa40a5969f9034b6453a62093d31 /generic
parentfc47c8aae5f8c68455ee588cfbe4f707e91bde7d (diff)
parent65acf25995e78db3c34b4cfd4998caf4edd4a5d8 (diff)
downloadtcl-1a3088ac3379f8ef5645a6fb601ed55a99c3870b.zip
tcl-1a3088ac3379f8ef5645a6fb601ed55a99c3870b.tar.gz
tcl-1a3088ac3379f8ef5645a6fb601ed55a99c3870b.tar.bz2
[10dc6daa37] [gets] on a non-blocking channel must take care so that 1) At least one call to the channel driver input proc gets made. Failure to do this locks up the channel - catastrophic FAIL. 2) After any driver call reports BLOCKED, don't call again. This is less serious, but FAILs to respect the non-blocking setting. Code corrections and tests included, to restore 8.6.1 compat.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 9283bf5..12f2af4 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) {
@@ -4622,6 +4623,10 @@ Tcl_GetsObj(
}
goto gotEOL;
}
+ if (GotFlag(statePtr, CHANNEL_BLOCKED|CHANNEL_NONBLOCKING)
+ == (CHANNEL_BLOCKED|CHANNEL_NONBLOCKING)) {
+ goto restore;
+ }
dst = dstEnd;
}
@@ -4801,6 +4806,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