diff options
author | dgp <dgp@users.sourceforge.net> | 2014-03-27 21:35:57 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-03-27 21:35:57 (GMT) |
commit | 06f376eefe2af7c3eb3f8131dacd6bc296a2fb71 (patch) | |
tree | 73af2feeab227e512482b284755dd230c7902110 /generic/tclIO.c | |
parent | bb3eb0aaa60aba47a0e857fa2e34e5eb7ba8263f (diff) | |
download | tcl-06f376eefe2af7c3eb3f8131dacd6bc296a2fb71.zip tcl-06f376eefe2af7c3eb3f8131dacd6bc296a2fb71.tar.gz tcl-06f376eefe2af7c3eb3f8131dacd6bc296a2fb71.tar.bz2 |
Minimal patch to fix iocmd-23.11. Might not be the best fix, but is *a* fix.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 3636861..c43e61e 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -3852,6 +3852,7 @@ Tcl_GetsObj( */ chanPtr = statePtr->topChanPtr; + Tcl_Preserve(chanPtr); bufPtr = statePtr->inQueueHead; encoding = statePtr->encoding; @@ -4144,6 +4145,7 @@ Tcl_GetsObj( done: UpdateInterest(chanPtr); + Tcl_Release(chanPtr); return copiedTotal; } @@ -4189,6 +4191,7 @@ TclGetsObjBinary( */ chanPtr = statePtr->topChanPtr; + Tcl_Preserve(chanPtr); bufPtr = statePtr->inQueueHead; @@ -4388,6 +4391,7 @@ TclGetsObjBinary( done: UpdateInterest(chanPtr); + Tcl_Release(chanPtr); return copiedTotal; } @@ -4860,6 +4864,7 @@ Tcl_ReadRaw( * requests more bytes. */ + Tcl_Preserve(chanPtr); for (copied = 0; copied < bytesToRead; copied += copiedNow) { copiedNow = CopyBuffer(chanPtr, bufPtr + copied, bytesToRead - copied); @@ -4946,7 +4951,7 @@ Tcl_ReadRaw( * over EAGAIN/WOULDBLOCK handling. */ - return copied; + goto done; } SetFlag(statePtr, CHANNEL_BLOCKED); @@ -4954,14 +4959,17 @@ Tcl_ReadRaw( } Tcl_SetErrno(result); - return -1; + copied = -1; + goto done; } - return copied + nread; + copied += nread; + goto done; } } done: + Tcl_Release(chanPtr); return copied; } @@ -5069,6 +5077,7 @@ DoReadChars( chanPtr = statePtr->topChanPtr; encoding = statePtr->encoding; factor = UTF_EXPANSION_FACTOR; + Tcl_Preserve(chanPtr); if (appendFlag == 0) { if (encoding == NULL) { @@ -5158,6 +5167,7 @@ DoReadChars( done: UpdateInterest(chanPtr); + Tcl_Release(chanPtr); return copied; } @@ -7700,6 +7710,11 @@ UpdateInterest( /* State info for channel */ int mask = statePtr->interestMask; + if (chanPtr->typePtr == NULL) { + /* Do not update interest on a closed channel */ + return; + } + /* * If there are flushed buffers waiting to be written, then we need to * watch for the channel to become writable. @@ -8785,6 +8800,7 @@ DoRead( * operation. */ + Tcl_Preserve(chanPtr); if (!(statePtr->flags & CHANNEL_STICKY_EOF)) { ResetFlag(statePtr, CHANNEL_EOF); } @@ -8822,6 +8838,7 @@ DoRead( done: UpdateInterest(chanPtr); + Tcl_Release(chanPtr); return copied; } |