[140637] trunk/base/src/pextlib1.0/tracelib.c

cal at macports.org cal at macports.org
Mon Sep 28 13:36:29 PDT 2015


Revision: 140637
          https://trac.macports.org/changeset/140637
Author:   cal at macports.org
Date:     2015-09-28 13:36:29 -0700 (Mon, 28 Sep 2015)
Log Message:
-----------
base: tracelib: rename vars to avoid naming conflicts

Overwriting a variable named $path in the global context may actually cause
problems and is bad style. Let's use a prefixed variable that's likely unique
enough to avoid conflicts.

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/tracelib.c

Modified: trunk/base/src/pextlib1.0/tracelib.c
===================================================================
--- trunk/base/src/pextlib1.0/tracelib.c	2015-09-28 20:33:13 UTC (rev 140636)
+++ trunk/base/src/pextlib1.0/tracelib.c	2015-09-28 20:36:29 UTC (rev 140637)
@@ -374,14 +374,14 @@
  * \param[in] path the offending path to be passed to the callback
  */
 static void sandbox_violation(int sock UNUSED, const char *path, sandbox_violation_t type) {
-    Tcl_SetVar(interp, "path", path, 0);
+    Tcl_SetVar(interp, "_sandbox_viol_path", path, 0);
     int retVal = TCL_OK;
     switch (type) {
         case SANDBOX_VIOLATION:
-            retVal = Tcl_Eval(interp, "slave_add_sandbox_violation $path");
+            retVal = Tcl_Eval(interp, "slave_add_sandbox_violation ${_sandbox_viol_path}");
             break;
         case SANDBOX_UNKNOWN:
-            retVal = Tcl_Eval(interp, "slave_add_sandbox_unknown $path");
+            retVal = Tcl_Eval(interp, "slave_add_sandbox_unknown ${_sandbox_viol_path}");
             break;
     }
 
@@ -389,7 +389,7 @@
         fprintf(stderr, "Error evaluating Tcl statement to add sandbox violation: %s\n", Tcl_GetStringResult(interp));
     }
 
-    Tcl_UnsetVar(interp, "path", 0);
+    Tcl_UnsetVar(interp, "_sandbox_viol_path", 0);
 }
 
 /**
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150928/fe331460/attachment.html>


More information about the macports-changes mailing list