summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2009-07-23 22:49:15 (GMT)
committerandreas_kupries <akupries@shaw.ca>2009-07-23 22:49:15 (GMT)
commitbd734d2cf44d9550acd5c2ca3e6c5b17f9b03f72 (patch)
treebb266e4b6080a9f87761ad98dbe1162bb8e036ad /generic
parentc1fefc1d02ee22ae574e79cc397b5a477b0efcf4 (diff)
downloadtcl-bd734d2cf44d9550acd5c2ca3e6c5b17f9b03f72.zip
tcl-bd734d2cf44d9550acd5c2ca3e6c5b17f9b03f72.tar.gz
tcl-bd734d2cf44d9550acd5c2ca3e6c5b17f9b03f72.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>
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c10
-rw-r--r--generic/tclPipe.c14
-rw-r--r--generic/tclVar.c15
3 files changed, 31 insertions, 8 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 7814e32..4f676e6 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclIO.c,v 1.159 2009/02/10 22:49:45 nijtmans Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.160 2009/07/23 22:49:15 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -2085,6 +2085,14 @@ Tcl_GetChannelHandle(
int result;
chanPtr = ((Channel *) chan)->state->bottomChanPtr;
+ if (!chanPtr->typePtr->getHandleProc) {
+ Tcl_Obj* err;
+ TclNewLiteralStringObj(err, "channel \"");
+ Tcl_AppendToObj(err, Tcl_GetChannelName(chan), -1);
+ Tcl_AppendToObj(err, "\" does not support OS handles", -1);
+ Tcl_SetChannelError (chan,err);
+ return TCL_ERROR;
+ }
result = chanPtr->typePtr->getHandleProc(chanPtr->instanceData, direction,
&handle);
if (handlePtr) {
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;
diff --git a/generic/tclVar.c b/generic/tclVar.c
index eb7cf53..c733dce 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclVar.c,v 1.179 2009/07/16 21:24:40 dgp Exp $
+ * RCS: @(#) $Id: tclVar.c,v 1.180 2009/07/23 22:49:15 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -67,10 +67,19 @@ VarHashCreateVar(
#define VarHashFindVar(tablePtr, key) \
VarHashCreateVar((tablePtr), (key), NULL)
-
+#ifdef _AIX
+/* Work around AIX cc problem causing crash in TclDeleteVars. Possible
+ * optimizer bug. Do _NOT_ inline this function, this re-activates the
+ * problem.
+ */
+static void
+VarHashInvalidateEntry(Var* varPtr) {
+ varPtr->flags |= VAR_DEAD_HASH;
+}
+#else
#define VarHashInvalidateEntry(varPtr) \
((varPtr)->flags |= VAR_DEAD_HASH)
-
+#endif
#define VarHashDeleteEntry(varPtr) \
Tcl_DeleteHashEntry(&(((VarInHash *) varPtr)->entry))