Added code that makes the bytecode file readable (needed by the generated shell
authorJohn Criswell <criswell@uiuc.edu>
Tue, 2 Sep 2003 21:11:22 +0000 (21:11 +0000)
committerJohn Criswell <criswell@uiuc.edu>
Tue, 2 Sep 2003 21:11:22 +0000 (21:11 +0000)
script).
Removed the use of sys/types.h and sys/stat.h.
Modified FileExists() so that it uses the access() system call to check for
file existance.  This requires less header files and might even be a tad bit
faster.

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

tools/gccld/gccld.cpp

index 1fd1b741fac6347e4afc9b54022f23118591d43c..a797488a43639417cdcba784fc1d9b8be58f8d4e 100644 (file)
 #include "Support/FileUtilities.h"
 #include "Support/CommandLine.h"
 #include "Support/Signals.h"
+#include "Config/unistd.h"
 #include <fstream>
 #include <memory>
 #include <set>
 #include <algorithm>
-#include <sys/types.h>     // For FileExists
-#include <sys/stat.h>
 
 namespace {
   cl::list<std::string> 
@@ -78,8 +77,7 @@ namespace {
 
 // FileExists - Return true if the specified string is an openable file...
 static inline bool FileExists(const std::string &FN) {
-  struct stat StatBuf;
-  return stat(FN.c_str(), &StatBuf) != -1;
+  return access(FN.c_str(), F_OK) != -1;
 }
 
 
@@ -445,8 +443,9 @@ int main(int argc, char **argv) {
     // Make the script executable...
     MakeFileExecutable (OutputFilename);
 
-    // Make the bytecode file directly executable in LLEE as well
+    // Make the bytecode file readable and directly executable in LLEE as well
     MakeFileExecutable (RealBytecodeOutput);
+    MakeFileReadable   (RealBytecodeOutput);
   }
 
   return 0;