aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Unix/Program.inc
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-07-28 22:08:15 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-07-28 22:08:15 +0000
commit9cd3dfe88245a79d2dc58b399f7bbbbb983c22ee (patch)
tree96c2db40e0e793b6387c86c50c9dc64746cf23e7 /lib/System/Unix/Program.inc
parentca768a7002a0409c3c2336025fe37231d5be3478 (diff)
downloadexternal_llvm-9cd3dfe88245a79d2dc58b399f7bbbbb983c22ee.zip
external_llvm-9cd3dfe88245a79d2dc58b399f7bbbbb983c22ee.tar.gz
external_llvm-9cd3dfe88245a79d2dc58b399f7bbbbb983c22ee.tar.bz2
Fix a fixme; don't take binaries from the working directory.
This fixes clang on non-darwin platforms if a file called 'ld' or 'as' is in the working directory. Based on patch by Pawel Worach! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Program.inc')
-rw-r--r--lib/System/Unix/Program.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index d4e88fd..7e82ef3 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -45,9 +45,9 @@ Program::FindProgramByName(const std::string& progName) {
Path temp;
if (!temp.set(progName)) // invalid name
return Path();
- // FIXME: have to check for absolute filename - we cannot assume anything
- // about "." being in $PATH
- if (temp.canExecute()) // already executable as is
+ // Use the given path verbatim if it contains any slashes; this matches
+ // the behavior of sh(1) and friends.
+ if (progName.find('/') != std::string::npos && temp.canExecute())
return temp;
// At this point, the file name is valid and its not executable