diff options
author | ru <ru@FreeBSD.org> | 2004-12-16 19:46:50 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2004-12-16 19:46:50 +0000 |
commit | de05db1167494a2d6a7743423900cb10c4e1a967 (patch) | |
tree | 860252468442729b539265d1fd4720c5eeae34e8 /usr.bin | |
parent | 0a2e8227c4ae6d6c6969ad77f2988a8114042b40 (diff) | |
download | FreeBSD-src-de05db1167494a2d6a7743423900cb10c4e1a967.zip FreeBSD-src-de05db1167494a2d6a7743423900cb10c4e1a967.tar.gz |
Fix a long-standing bug when make(1) is passed the -V and
-f options in MAKEFLAGS environment variable, and some of
these options are also specified on the command line.
Thanks to: marcel
Reviewed by: harti
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/make/main.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index ad114a4..8de4d1f 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -171,7 +171,6 @@ MFLAGS_append(char *flag, char *arg) static void MainParseArgs(int argc, char **argv) { - char *p; int c; optind = 1; /* since we're called more than once */ @@ -191,7 +190,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) { MFLAGS_append("-I", optarg); break; case 'V': - Lst_AtEnd(&variables, (void *)optarg); + Lst_AtEnd(&variables, estrdup(optarg)); MFLAGS_append("-V", optarg); break; case 'X': @@ -266,9 +265,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) { break; } case 'E': - p = emalloc(strlen(optarg) + 1); - strcpy(p, optarg); - Lst_AtEnd(&envFirstVars, p); + Lst_AtEnd(&envFirstVars, estrdup(optarg)); MFLAGS_append("-E", optarg); break; case 'e': @@ -276,7 +273,7 @@ rearg: while((c = getopt(argc, argv, OPTFLAGS)) != -1) { MFLAGS_append("-e", NULL); break; case 'f': - Lst_AtEnd(&makefiles, optarg); + Lst_AtEnd(&makefiles, estrdup(optarg)); break; case 'i': ignoreErrors = TRUE; @@ -880,8 +877,8 @@ main(int argc, char **argv) Lst_Destroy(&targs, NOFREE); } - Lst_Destroy(&variables, NOFREE); - Lst_Destroy(&makefiles, NOFREE); + Lst_Destroy(&variables, free); + Lst_Destroy(&makefiles, free); Lst_Destroy(&create, free); /* print the graph now it's been processed if the user requested it */ |