diff options
| author | dgp@users.sourceforge.net <dgp> | 2012-10-03 15:22:15 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2012-10-03 15:22:15 (GMT) |
| commit | 6a27b355f25492d9603cfd7f30148fda8dba53c7 (patch) | |
| tree | 9663b779f37892532c8ea60a31c80b4a68e6a1f1 /generic/tclIO.c | |
| parent | 69f9290d2b708e87a3ee51d962833c21da6e0673 (diff) | |
| download | tcl-6a27b355f25492d9603cfd7f30148fda8dba53c7.zip tcl-6a27b355f25492d9603cfd7f30148fda8dba53c7.tar.gz tcl-6a27b355f25492d9603cfd7f30148fda8dba53c7.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.
Diffstat (limited to 'generic/tclIO.c')
| -rw-r--r-- | generic/tclIO.c | 44 |
1 files changed, 24 insertions, 20 deletions
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; + } } } |
