summaryrefslogtreecommitdiffstats
path: root/generic/tclPipe.c
diff options
context:
space:
mode:
authorandreas_kupries <andreas_kupries@noemail.net>2009-07-23 22:49:15 (GMT)
committerandreas_kupries <andreas_kupries@noemail.net>2009-07-23 22:49:15 (GMT)
commit54118970b43d1322d9a48cb13c46117fa0e13d17 (patch)
treebb266e4b6080a9f87761ad98dbe1162bb8e036ad /generic/tclPipe.c
parent8193e35a36346fcd08bd5b1b5bdc305dc2d18792 (diff)
downloadtcl-54118970b43d1322d9a48cb13c46117fa0e13d17.zip
tcl-54118970b43d1322d9a48cb13c46117fa0e13d17.tar.gz
tcl-54118970b43d1322d9a48cb13c46117fa0e13d17.tar.bz2
* generic/tclIO.c (Tcl_GetChannelHandle): Do not crash for
* generic/tclPipe.c (FileForRedirect): getHandleProc == NULL, this is allowed. Provide a nice error message in the bypass area. Updated caller to check the bypass for a mesage. This fixes the bug [Bug 2826248] reported by Andy Sonnenburg <andy22286@users.sourceforge.net> FossilOrigin-Name: 9039eeb584bc750f8a27233a671b631945b48d10
Diffstat (limited to 'generic/tclPipe.c')
-rw-r--r--generic/tclPipe.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/generic/tclPipe.c b/generic/tclPipe.c
index b20ffe1..e8e4f74 100644
--- a/generic/tclPipe.c
+++ b/generic/tclPipe.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPipe.c,v 1.21 2009/01/09 11:21:46 dkf Exp $
+ * RCS: @(#) $Id: tclPipe.c,v 1.22 2009/07/23 22:49:15 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -102,9 +102,15 @@ FileForRedirect(
}
file = TclpMakeFile(chan, writing ? TCL_WRITABLE : TCL_READABLE);
if (file == NULL) {
- Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan),
- "\" wasn't opened for ",
- ((writing) ? "writing" : "reading"), NULL);
+ Tcl_Obj* msg;
+ Tcl_GetChannelError(chan, &msg);
+ if (msg) {
+ Tcl_SetObjResult (interp, msg);
+ } else {
+ Tcl_AppendResult(interp, "channel \"", Tcl_GetChannelName(chan),
+ "\" wasn't opened for ",
+ ((writing) ? "writing" : "reading"), NULL);
+ }
return NULL;
}
*releasePtr = 1;