Tweak r199835 to use can_execute() instead of exists()
authorAlp Toker <alp@nuanti.com>
Wed, 22 Jan 2014 22:17:51 +0000 (22:17 +0000)
committerAlp Toker <alp@nuanti.com>
Wed, 22 Jan 2014 22:17:51 +0000 (22:17 +0000)
The execution code path crashes if it can't execute the binary so we might as
well take precautions here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199844 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/lli.cpp

index e6d4087476fcc11d1ed93cebaf058be5f02d8556..e36d91795840d749dd0c3f97cd2ff337b4075b4d 100644 (file)
@@ -668,8 +668,9 @@ int main(int argc, char **argv, char * const *envp) {
                << "  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));