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!

llvm-svn: 77379
This commit is contained in:
Benjamin Kramer 2009-07-28 22:08:15 +00:00
parent f869caa03f
commit 6adb6e07ce
1 changed files with 3 additions and 3 deletions

View File

@ -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