aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2003-01-13 23:53:46 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2003-01-13 23:53:46 +0000
commit597b8f6add0f301afb48441645ec1d65fc73a372 (patch)
treeb2391a3432f6514ca22612f82bf04eb6ff4372a8 /usr.bin/make
parent2ffaffaa6e51a7e7f61076e57539b4e3e76b425f (diff)
Notes
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index b5b2b020aeaf..32da4e860d2f 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1349,6 +1349,17 @@ Var_Parse(char *str, GNode *ctxt, Boolean err, int *lengthPtr, Boolean *freePtr)
cp++;
}
+ /*
+ * Replacing the empty string for something else when
+ * done globally causes an infinite loop. The only
+ * meaningful substitution of the empty string would
+ * be those anchored by '^' or '$'. Thus, we can
+ * safely turn the substitution into a non-global one
+ * if the LHS is the empty string.
+ */
+ if (pattern.leftLen == 0)
+ pattern.flags &= ~VAR_SUB_GLOBAL;
+
termc = *cp;
newStr = VarModify(str, VarSubstitute,
(void *)&pattern);