summaryrefslogtreecommitdiffstats
path: root/generic/tclLink.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-06-21 14:09:31 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-06-21 14:09:31 (GMT)
commit83102e6f2f98d36d59b7b69132074e9724dc2feb (patch)
tree429c7a079c9e330badf90fa60fbe2fd7f46f64f1 /generic/tclLink.c
parent5bc58dfd6d5f986104e6427cd158cacfbfcd6a70 (diff)
downloadtcl-83102e6f2f98d36d59b7b69132074e9724dc2feb.zip
tcl-83102e6f2f98d36d59b7b69132074e9724dc2feb.tar.gz
tcl-83102e6f2f98d36d59b7b69132074e9724dc2feb.tar.bz2
3317466 Prevent multiple Tcl_LinkVar() links to a single Tcl variable.
Diffstat (limited to 'generic/tclLink.c')
-rw-r--r--generic/tclLink.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c
index df8b16a..f7911a4 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -112,6 +112,14 @@ Tcl_LinkVar(
Link *linkPtr;
int code;
+ linkPtr = (Link *) Tcl_VarTraceInfo(interp, varName, TCL_GLOBAL_ONLY,
+ LinkTraceProc, (ClientData) NULL);
+ if (linkPtr != NULL) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "variable '%s' is already linked", varName));
+ return TCL_ERROR;
+ }
+
linkPtr = (Link *) ckalloc(sizeof(Link));
linkPtr->interp = interp;
linkPtr->varName = Tcl_NewStringObj(varName, -1);