[llvm] r199844 - Tweak r199835 to use can_execute() instead of exists()

Alp Toker alp at nuanti.com
Wed Jan 22 14:17:52 PST 2014


Author: alp
Date: Wed Jan 22 16:17:51 2014
New Revision: 199844

URL: http://llvm.org/viewvc/llvm-project?rev=199844&view=rev
Log:
Tweak r199835 to use can_execute() instead of exists()

The execution code path crashes if it can't execute the binary so we might as
well take precautions here.

Modified:
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=199844&r1=199843&r2=199844&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Jan 22 16:17:51 2014
@@ -668,8 +668,9 @@ int main(int argc, char **argv, char * c
                << "  Defaulting to simulated remote execution\n";
         Target.reset(RemoteTarget::createRemoteTarget());
       } else {
-        if (!sys::fs::exists(ChildExecPath)) {
-          errs() << "Unable to find child target: '" << ChildExecPath << "'\n";
+        if (!sys::fs::can_execute(ChildExecPath)) {
+          errs() << "Unable to find usable child executable: '" << ChildExecPath
+                 << "'\n";
           return -1;
         }
         Target.reset(RemoteTarget::createExternalRemoteTarget(ChildExecPath));





More information about the llvm-commits mailing list