diff options
author | dgp <dgp@users.sourceforge.net> | 2012-10-03 15:29:59 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-10-03 15:29:59 (GMT) |
commit | 619cb58e37350334a638f134b25cf98f238d1e34 (patch) | |
tree | f5a13906329fd2a415bdfe358595e2c98c74d00a /generic/tclIO.c | |
parent | 4158ed432ea1162e7c8a973ef7c2bc368374a938 (diff) | |
parent | 570d1f597600fd4e019636e74fc5d1a74bc0b53e (diff) | |
download | tcl-619cb58e37350334a638f134b25cf98f238d1e34.zip tcl-619cb58e37350334a638f134b25cf98f238d1e34.tar.gz tcl-619cb58e37350334a638f134b25cf98f238d1e34.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 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index eeca41b..e2415d8 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -748,21 +748,25 @@ CheckForStdChannelsBeingClosed( ChannelState *statePtr = ((Channel *) chan)->state; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if ((chan == tsdPtr->stdinChannel) && (tsdPtr->stdinInitialized)) { + if (tsdPtr->stdinInitialized + && tsdPtr->stdinChannel != NULL + && statePtr == ((Channel *)tsdPtr->stdinChannel)->state) { if (statePtr->refCount < 2) { statePtr->refCount = 0; tsdPtr->stdinChannel = NULL; return; } - } else if ((chan == tsdPtr->stdoutChannel) - && (tsdPtr->stdoutInitialized)) { + } 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 ((chan == tsdPtr->stderrChannel) - && (tsdPtr->stderrInitialized)) { + } else if (tsdPtr->stderrInitialized + && tsdPtr->stderrChannel != NULL + && statePtr == ((Channel *)tsdPtr->stderrChannel)->state) { if (statePtr->refCount < 2) { statePtr->refCount = 0; tsdPtr->stderrChannel = NULL; |