summaryrefslogtreecommitdiff
path: root/usr.bin/make/main.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-03 09:50:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-03 09:50:48 +0000
commitcbace917fd2c3597b630f6188dea5ed598dae0f4 (patch)
tree58731621428bbf7c259c78471fd0bb94701a87a5 /usr.bin/make/main.c
parentfb92d51c9f0a7b8df6a6a8bfa4b7d4032babcc84 (diff)
Parse_DoVar() trashes string, so pass it a strdup()'d copy of *argv...
then kvm_getargv will show a nice unhacked argument list
Diffstat (limited to 'usr.bin/make/main.c')
-rw-r--r--usr.bin/make/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 1ce33b647d3..5ff3e33217d 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -316,9 +316,12 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != EOF) {
* on the end of the "create" list.
*/
for (argv += optind, argc -= optind; *argv; ++argv, --argc)
- if (Parse_IsVar(*argv))
- Parse_DoVar(*argv, VAR_CMD);
- else {
+ if (Parse_IsVar(*argv)) {
+ char *var = strdup(*argv);
+
+ Parse_DoVar(var, VAR_CMD);
+ free(var);
+ } else {
if (!**argv)
Punt("illegal (null) argument.");
if (**argv == '-') {