summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2016-02-19 10:49:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2016-02-19 10:49:57 (GMT)
commit52862d4aeb45df2aad6c9d0b2ef00fcb89790be8 (patch)
tree25e381491fef4a6c92c639b8baad38a75c0e303f
parentf7ea5b6cc57fafcbcb3377e83fdbc4d999d123d4 (diff)
downloadtcl-52862d4aeb45df2aad6c9d0b2ef00fcb89790be8.zip
tcl-52862d4aeb45df2aad6c9d0b2ef00fcb89790be8.tar.gz
tcl-52862d4aeb45df2aad6c9d0b2ef00fcb89790be8.tar.bz2
Proposed fix for [9b47029467631832]: testing existence of env(some_thing) destroys traces.
Was the comment [http://core.tcl.tk/tcl/artifact/f93c0675115b73ce?ln=554|here] not correct after all?.
-rw-r--r--generic/tclEnv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 2cb240d..66ddb57 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -551,7 +551,8 @@ TclGetEnv(
* array.
*
* Results:
- * Always returns NULL to indicate success.
+ * Returns NULL to indicate success, or an error-message if the array
+ * element being handled doesn't exist.
*
* Side effects:
* Environment variable changes get propagated. If the whole "env" array
@@ -609,8 +610,7 @@ EnvTraceProc(
const char *value = TclGetEnv(name2, &valueString);
if (value == NULL) {
- Tcl_UnsetVar2(interp, name1, name2, 0);
- return NULL;
+ return (char *) "no such variable";
}
Tcl_SetVar2(interp, name1, name2, value, 0);
Tcl_DStringFree(&valueString);