Added code that makes the bytecode file readable (needed by the generated shell

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.

llvm-svn: 8328
This commit is contained in:
John Criswell 2003-09-02 21:11:22 +00:00
parent b83a22bd82
commit a3ce8b48b0
1 changed files with 4 additions and 5 deletions

View File

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