toolchain-wrapper: fix breakage after host/usr removal
authorArnout Vandecappelle <arnout@mind.be>
Fri, 7 Jul 2017 07:43:30 +0000 (09:43 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Fri, 7 Jul 2017 07:57:14 +0000 (09:57 +0200)
The toolchain wrapper, when called through PATH, strips the last three
levels of /proc/self/exe to find HOST_DIR. However, after the host/usr
removal, this should be just two levels.

The toolchain wrapper has different logic for when it is called with a
full path (i.e. $HOST_DIR/usr/bin/arm-linux-gcc) then when it is called
through the PATH (i.e. just arm-linux-gcc). The latter is never used
internally in Buildroot, that's why this wasn't discovered through
testing.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Mark Jackson <mpfj-list@newflow.co.uk>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
toolchain/toolchain-wrapper.c

index 3a4455ff829d6eba1daff1f299f0158eadfabafa..a73e6d6f940bf28e9ee727e0415661c340e080e2 100644 (file)
@@ -192,7 +192,7 @@ int main(int argc, char **argv)
                for (i = ret; i > 0; i--) {
                        if (absbasedir[i] == '/') {
                                absbasedir[i] = '\0';
-                               if (++count == 3)
+                               if (++count == 2)
                                        break;
                        }
                }