diff options
| author | sjg <sjg@NetBSD.org> | 2023-06-16 22:30:35 +0000 |
|---|---|---|
| committer | sjg <sjg@NetBSD.org> | 2023-06-16 22:30:35 +0000 |
| commit | 16d9530b45a7d814e76256f123610abf6b012fa1 (patch) | |
| tree | daef71aa1eca74a3e91e8d9ba485b51c98331751 /usr.bin/make | |
| parent | 8858fa2c3586471d403a48d0070ae6f9b0b07f97 (diff) | |
make: do not allow delete of readOnly variable.
Sometimes we mark a variable readOnly to guard against .undef
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/var.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 33c0bd41131..4effe80295f 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -513,6 +513,11 @@ Var_Delete(GNode *scope, const char *varname) DEBUG2(VAR, "%s: delete %s\n", scope->name, varname); v = he->value; + if (v->readOnly) { + DEBUG2(VAR, "%s: delete %s (readOnly)\n", + scope->name, varname); + return; + } if (v->inUse) { Parse_Error(PARSE_FATAL, "Cannot delete variable \"%s\" while it is used", |
