diff options
author | dgp <dgp@users.sourceforge.net> | 2012-10-03 15:18:32 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-10-03 15:18:32 (GMT) |
commit | de5687769c8034c6d0d32e207f9934e3a3fed533 (patch) | |
tree | 99311b099d6351ced0f2e3b2b8ad74034c11c97e | |
parent | 9d29fc1ebfbb48cc19bf87541750abfbaeab3c31 (diff) | |
download | tcl-de5687769c8034c6d0d32e207f9934e3a3fed533.zip tcl-de5687769c8034c6d0d32e207f9934e3a3fed533.tar.gz tcl-de5687769c8034c6d0d32e207f9934e3a3fed533.tar.bz2 |
When checking for std channels being closed, compare the channel state,
not the channel itself so that stacked channels do not cause trouble.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclIO.c | 44 |
2 files changed, 30 insertions, 20 deletions
@@ -1,3 +1,9 @@ +2012-10-03 Don Porter <dgp@users.sourceforge.net> + + * generic/tclIO.c: When checking for std channels being closed, + compare the channel state, not the channel itself so that stacked + channels do not cause trouble. + 2012-08-17 Jan Nijtmans <nijtmans@users.sf.net> * win/nmakehlp.c: Add "-V<num>" option, in order to be able diff --git a/generic/tclIO.c b/generic/tclIO.c index b9cd30c..eace472 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -697,26 +697,30 @@ CheckForStdChannelsBeingClosed(chan) ChannelState *statePtr = ((Channel *) chan)->state; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if ((chan == tsdPtr->stdinChannel) && (tsdPtr->stdinInitialized)) { - if (statePtr->refCount < 2) { - statePtr->refCount = 0; - tsdPtr->stdinChannel = NULL; - return; - } - } else if ((chan == tsdPtr->stdoutChannel) - && (tsdPtr->stdoutInitialized)) { - if (statePtr->refCount < 2) { - statePtr->refCount = 0; - tsdPtr->stdoutChannel = NULL; - return; - } - } else if ((chan == tsdPtr->stderrChannel) - && (tsdPtr->stderrInitialized)) { - if (statePtr->refCount < 2) { - statePtr->refCount = 0; - tsdPtr->stderrChannel = NULL; - return; - } + if (tsdPtr->stdinInitialized + && tsdPtr->stdinChannel != NULL + && statePtr == ((Channel *)tsdPtr->stdinChannel)->state) { + if (statePtr->refCount < 2) { + statePtr->refCount = 0; + tsdPtr->stdinChannel = NULL; + return; + } + } else if (tsdPtr->stdoutInitialized + && tsdPtr->stdoutChannel != NULL + && statePtr == ((Channel *)tsdPtr->stdoutChannel)->state) { + if (statePtr->refCount < 2) { + statePtr->refCount = 0; + tsdPtr->stdoutChannel = NULL; + return; + } + } else if (tsdPtr->stderrInitialized + && tsdPtr->stderrChannel != NULL + && statePtr == ((Channel *)tsdPtr->stderrChannel)->state) { + if (statePtr->refCount < 2) { + statePtr->refCount = 0; + tsdPtr->stderrChannel = NULL; + return; + } } } |