diff options
-rw-r--r-- | contrib/bmake/var.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/contrib/bmake/var.c b/contrib/bmake/var.c index 13be7d6..bbf7269 100644 --- a/contrib/bmake/var.c +++ b/contrib/bmake/var.c @@ -540,11 +540,20 @@ void Var_Delete(const char *name, GNode *ctxt) { Hash_Entry *ln; - - ln = Hash_FindEntry(&ctxt->context, name); + char *cp; + + if (strchr(name, '$')) { + cp = Var_Subst(NULL, name, VAR_GLOBAL, 0); + } else { + cp = name; + } + ln = Hash_FindEntry(&ctxt->context, cp); if (DEBUG(VAR)) { fprintf(debug_file, "%s:delete %s%s\n", - ctxt->name, name, ln ? "" : " (not found)"); + ctxt->name, cp, ln ? "" : " (not found)"); + } + if (cp != name) { + free(cp); } if (ln != NULL) { Var *v; |