summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2023-06-16 22:30:35 +0000
committersjg <sjg@NetBSD.org>2023-06-16 22:30:35 +0000
commit16d9530b45a7d814e76256f123610abf6b012fa1 (patch)
treedaef71aa1eca74a3e91e8d9ba485b51c98331751 /usr.bin/make
parent8858fa2c3586471d403a48d0070ae6f9b0b07f97 (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.c9
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",