aboutsummaryrefslogtreecommitdiff
path: root/gcc/collect2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r--gcc/collect2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 62a79d3..ea97261 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -853,10 +853,14 @@ find_a_file (pprefix, name)
else
for (pl = pprefix->plist; pl; pl = pl->next)
{
+ struct stat st;
+
strcpy (temp, pl->prefix);
strcat (temp, name);
- if (access (temp, X_OK) == 0)
+ if (stat (temp, &st) >= 0
+ && ! S_ISDIR (st.st_mode)
+ && access (temp, X_OK) == 0)
return temp;
#ifdef EXECUTABLE_SUFFIX
@@ -864,7 +868,9 @@ find_a_file (pprefix, name)
So try appending that. */
strcat (temp, EXECUTABLE_SUFFIX);
- if (access (temp, X_OK) == 0)
+ if (stat (temp, &st) >= 0
+ && ! S_ISDIR (st.st_mode)
+ && access (temp, X_OK) == 0)
return temp;
#endif
}