Radar 9335669: Fix driver-driver to handle multiple levels of sym links.
--- Merging r105535 into '.':
U driverdriver.c
llvm-svn: 130188
diff --git a/llvm-gcc-4.2/driverdriver.c b/llvm-gcc-4.2/driverdriver.c
index 9edae4c..130de17 100644
--- a/llvm-gcc-4.2/driverdriver.c
+++ b/llvm-gcc-4.2/driverdriver.c
@@ -1306,8 +1306,8 @@
/* If argv[0] is a symbolic link, use the directory of the pointed-to file
to find compiler components. */
-
- if ((linklen = readlink (argv[0], path_buffer, PATH_MAX)) != -1)
+ /* LLVM LOCAL: loop to follow multiple levels of links */
+ while ((linklen = readlink (argv[0], path_buffer, PATH_MAX)) != -1)
{
/* readlink succeeds if argv[0] is a symlink. path_buffer now contains
the file referenced. */