If the CC environment variable contains multiple words then split
it up into separate exec arguments. Reviewed by: markm
This commit is contained in:
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
@@ -583,7 +584,7 @@ static void
|
|||||||
fname(const char *name)
|
fname(const char *name)
|
||||||
{
|
{
|
||||||
const char *bn, *suff;
|
const char *bn, *suff;
|
||||||
char **args, *ofn, *pathname, *CC;
|
char **args, *ofn, *p, *pathname;
|
||||||
size_t len;
|
size_t len;
|
||||||
int is_stdin;
|
int is_stdin;
|
||||||
int fd;
|
int fd;
|
||||||
@@ -643,10 +644,13 @@ fname(const char *name)
|
|||||||
if (getenv("CC") == NULL) {
|
if (getenv("CC") == NULL) {
|
||||||
pathname = xmalloc(strlen(PATH_USRBIN) + sizeof ("/cc"));
|
pathname = xmalloc(strlen(PATH_USRBIN) + sizeof ("/cc"));
|
||||||
(void)sprintf(pathname, "%s/cc", PATH_USRBIN);
|
(void)sprintf(pathname, "%s/cc", PATH_USRBIN);
|
||||||
} else
|
|
||||||
pathname = strdup(getenv("CC"));
|
|
||||||
|
|
||||||
appcstrg(&args, pathname);
|
appcstrg(&args, pathname);
|
||||||
|
} else {
|
||||||
|
pathname = strdup(getenv("CC"));
|
||||||
|
for (p = strtok(pathname, " \t"); p; p = strtok(NULL, " \t"))
|
||||||
|
appcstrg(&args, p);
|
||||||
|
}
|
||||||
|
|
||||||
applst(&args, cflags);
|
applst(&args, cflags);
|
||||||
applst(&args, lcflags);
|
applst(&args, lcflags);
|
||||||
appcstrg(&args, name);
|
appcstrg(&args, name);
|
||||||
|
|||||||
Reference in New Issue
Block a user