diff options
author | Shawn Landden <shawn@git.icu> | 2018-07-30 17:52:23 -0700 |
---|---|---|
committer | Shawn Landden <shawn@git.icu> | 2018-07-30 17:53:45 -0700 |
commit | 5b57482cf5d7debfaad7b635da14c00d4c0790d6 (patch) | |
tree | 3e71c6c12e67c60afb26ab9339e79b48ceaa3305 | |
parent | 8600f0857dac55ea393dc11a860948692d215fc8 (diff) | |
download | distcc-git-5b57482cf5d7debfaad7b635da14c00d4c0790d6.tar.gz |
cross-compile: fix generic "cc", "c++" cross-compile support
when PATH include /usr/lib/distcc
also fix a strict aliasing issue
-rw-r--r-- | src/compile.c | 4 | ||||
-rw-r--r-- | src/util.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/compile.c b/src/compile.c index e45fba5..8f90151 100644 --- a/src/compile.c +++ b/src/compile.c @@ -491,7 +491,9 @@ static void dcc_rewrite_generic_compiler(char **argv) if ((st.st_mode & S_IFMT) == S_IFLNK) { /* this is a Debian thing. Fedora just has /usr/bin/cc -> gcc */ if (strcmp(linkbuf, cpp ? "/etc/alternatives/c++" : "/etc/alternatives/cc") == 0) { - ssz = readlinkat(dir, linkbuf, linkbuf, sizeof(linkbuf) - 1); + char *intermediate_link = strdupa(linkbuf); + + ssz = readlinkat(dir, intermediate_link, linkbuf, sizeof(linkbuf) - 1); linkbuf[ssz] = '\0'; } } @@ -585,6 +585,8 @@ int dcc_which(const char *command, char **out) if (!path) return -ENOENT; do { + if (strstr(path, "distcc")) + continue; /* emulate strchrnul() */ t = strchr(path, ':'); if (!t) |