diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-11-08 12:35:56 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-11-08 12:35:56 +0000 |
commit | 0d82bac4704f94567dbd611bfe404456c5879eb3 (patch) | |
tree | 4d4dd73f7a543d3a7b923b88c0606b4ff929333b /llvm/tools/llvm-ar/llvm-ar.cpp | |
parent | 2c9341f979378da8af58a9be7eb179294c48378e (diff) | |
download | bcm5719-llvm-0d82bac4704f94567dbd611bfe404456c5879eb3.tar.gz bcm5719-llvm-0d82bac4704f94567dbd611bfe404456c5879eb3.zip |
llvm-ar: Let opening a directory failed in llvm-ar.
Linux cannot open directories with open(2), although cygwin and *bsd can.
Motivation: The test, Object/directory.ll, had been failing with --target=cygwin on Linux. XFAIL was improper for host issues.
llvm-svn: 194257
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
-rw-r--r-- | llvm/tools/llvm-ar/llvm-ar.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp index 64ef3fa1bb9..d70db728f2d 100644 --- a/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/llvm/tools/llvm-ar/llvm-ar.cpp @@ -782,6 +782,13 @@ static void performWriteOperation(ArchiveOperation Operation, sys::fs::file_status Status; failIfError(sys::fs::status(FD, Status), FileName); + // Opening a directory doesn't make sense. Let it failed. + // Linux cannot open directories with open(2), although + // cygwin and *bsd can. + if (Status.type() == sys::fs::file_type::directory_file) + failIfError(error_code(errc::is_a_directory, posix_category()), + FileName); + OwningPtr<MemoryBuffer> File; failIfError(MemoryBuffer::getOpenFile(FD, FileName, File, Status.getSize(), false), |