Skip to content

Commit

Permalink
Fix bind log interpreter results
Browse files Browse the repository at this point in the history
Found by: DasBrain
Patch by: DasBrain
  • Loading branch information
DasBrain authored Dec 1, 2024
1 parent ba2052f commit 1e56584
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tclhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,13 +1240,19 @@ void check_tcl_die(char *reason)
void check_tcl_log(int lv, char *chan, char *msg)
{
char mask[512];
Tcl_Obj* prev_result;

/* We have to store the old result, as check_tcl_bind may override it */
prev_result = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(prev_result);
egg_snprintf(mask, sizeof mask, "%s %s", chan, msg);
Tcl_SetVar(interp, "_log1", masktype(lv), TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "_log2", chan, TCL_GLOBAL_ONLY);
Tcl_SetVar(interp, "_log3", msg, TCL_GLOBAL_ONLY);
check_tcl_bind(H_log, mask, 0, " $::_log1 $::_log2 $::_log3",
MATCH_MASK | BIND_STACKABLE);
Tcl_SetObjResult(interp, prev_result);
Tcl_DecrRefCount(prev_result);
}

#ifdef TLS
Expand Down

0 comments on commit 1e56584

Please sign in to comment.