Module Name: src
Committed By: rillig
Date: Tue Sep 22 19:51:19 UTC 2020
Modified Files:
src/usr.bin/make: main.c
Log Message:
make(1): fix unnecessary length limitation for -v option
To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/usr.bin/make/main.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.339 src/usr.bin/make/main.c:1.340
--- src/usr.bin/make/main.c:1.339 Tue Sep 22 05:12:08 2020
+++ src/usr.bin/make/main.c Tue Sep 22 19:51:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $ */
+/* $NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -126,7 +126,7 @@
#endif
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.339 2020/09/22 05:12:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.340 2020/09/22 19:51:19 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\
The Regents of the University of California. All rights reserved.");
@@ -867,13 +867,9 @@ doPrintVars(void)
if (strchr(var, '$')) {
value = p1 = Var_Subst(var, VAR_GLOBAL, VARE_WANTRES);
} else if (expandVars) {
- char tmp[128];
- int len = snprintf(tmp, sizeof(tmp), "${%s}", var);
-
- if (len >= (int)sizeof(tmp))
- Fatal("%s: variable name too big: %s",
- progname, var);
- value = p1 = Var_Subst(tmp, VAR_GLOBAL, VARE_WANTRES);
+ char *expr = str_concat3("${", var, "}");
+ value = p1 = Var_Subst(expr, VAR_GLOBAL, VARE_WANTRES);
+ free(expr);
} else {
value = Var_Value(var, VAR_GLOBAL, &p1);
}