diff options
author | Ian Lance Taylor <ian@zembu.com> | 1999-08-04 07:45:10 +0000 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1999-08-04 01:45:10 -0600 |
commit | ca6062011d6bf45dbf4c2f9a7d12f671a58f50b7 (patch) | |
tree | 89008bf231e3566bf6c5354c788a05cf2957f413 /gcc/collect2.c | |
parent | 0c26b18a0dbb2225f7524b1c83f9d88ad1966bdc (diff) | |
download | gcc-ca6062011d6bf45dbf4c2f9a7d12f671a58f50b7.zip gcc-ca6062011d6bf45dbf4c2f9a7d12f671a58f50b7.tar.gz gcc-ca6062011d6bf45dbf4c2f9a7d12f671a58f50b7.tar.bz2 |
gcc.c (access_check): New static function.
* gcc.c (access_check): New static function.
(find_a_file): Use it when searching a directory list.
* collect2.c (find_a_file): Don't accept directories found when
searching a directory list.
From-SVN: r28486
Diffstat (limited to 'gcc/collect2.c')
-rw-r--r-- | gcc/collect2.c | 10 |
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 } |