[llvm-commits] [llvm] r77379 - /llvm/trunk/lib/System/Unix/Program.inc
Benjamin Kramer
benny.kra at googlemail.com
Tue Jul 28 15:08:15 PDT 2009
Author: d0k
Date: Tue Jul 28 17:08:15 2009
New Revision: 77379
URL: http://llvm.org/viewvc/llvm-project?rev=77379&view=rev
Log:
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!
Modified:
llvm/trunk/lib/System/Unix/Program.inc
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=77379&r1=77378&r2=77379&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Tue Jul 28 17:08:15 2009
@@ -45,9 +45,9 @@
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
More information about the llvm-commits
mailing list