summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-10-18 19:50:19 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-10-18 19:50:19 (GMT)
commit9f2c3815f73b6453baadeb29e4238d3bc18d51c4 (patch)
tree4330827fe448f166eb6e34fc1fe06ee5d8bb0291 /generic/tclIO.c
parent59f2031ac54d010c84ee64e6626a119959c645a6 (diff)
parent592ab670f31771d34eb4ff0d879ce894696c061c (diff)
downloadtcl-9f2c3815f73b6453baadeb29e4238d3bc18d51c4.zip
tcl-9f2c3815f73b6453baadeb29e4238d3bc18d51c4.tar.gz
tcl-9f2c3815f73b6453baadeb29e4238d3bc18d51c4.tar.bz2
[10dc6daa37] New fix for [gets] on non-blocking channel. This time
properly accounts for the effects of ENCODING_LINESIZE.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index d1f22c1..0122ec9 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4042,6 +4042,7 @@ Tcl_GetsObj(
eof = NULL;
inEofChar = statePtr->inEofChar;
+ ResetFlag(statePtr, CHANNEL_BLOCKED);
while (1) {
if (dst >= dstEnd) {
if (FilterInputBytes(chanPtr, &gs) != 0) {
@@ -4386,6 +4387,7 @@ TclGetsObjBinary(
/* Only handle TCL_TRANSLATE_LF and TCL_TRANSLATE_CR */
eolChar = (statePtr->inputTranslation == TCL_TRANSLATE_LF) ? '\n' : '\r';
+ ResetFlag(statePtr, CHANNEL_BLOCKED);
while (1) {
/*
* Subtract the number of bytes that were removed from channel
@@ -4674,6 +4676,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;
@@ -4764,12 +4772,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 {