summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-10-18 20:03:08 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-10-18 20:03:08 (GMT)
commitfe445f7962f05b59609189e8ec30cb508705ca37 (patch)
tree8794e2066f0ad9b1ea74a3ea72aeb9f3469259ef /generic/tclIO.c
parentfc47c8aae5f8c68455ee588cfbe4f707e91bde7d (diff)
parentb15488bf6e8d9be3ad5143e3f97d952f33938a83 (diff)
downloadtcl-fe445f7962f05b59609189e8ec30cb508705ca37.zip
tcl-fe445f7962f05b59609189e8ec30cb508705ca37.tar.gz
tcl-fe445f7962f05b59609189e8ec30cb508705ca37.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 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 {