[llvm] r297679 - Make FileOutputBuffer fail early if you pass a directory.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 15:19:05 PDT 2017
Author: ruiu
Date: Mon Mar 13 17:19:05 2017
New Revision: 297679
URL: http://llvm.org/viewvc/llvm-project?rev=297679&view=rev
Log:
Make FileOutputBuffer fail early if you pass a directory.
Previously, it created a temporary directory and then failed when
FileOutputBuffer tried to rename that file to the destination file
(which is actually a directory name).
Differential Revision: https://reviews.llvm.org/D30912
Modified:
llvm/trunk/lib/Support/FileOutputBuffer.cpp
Modified: llvm/trunk/lib/Support/FileOutputBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileOutputBuffer.cpp?rev=297679&r1=297678&r2=297679&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FileOutputBuffer.cpp (original)
+++ llvm/trunk/lib/Support/FileOutputBuffer.cpp Mon Mar 13 17:19:05 2017
@@ -57,6 +57,8 @@ FileOutputBuffer::create(StringRef FileP
// FIXME: In posix, you use the access() call to check this.
}
break;
+ case sys::fs::file_type::directory_file:
+ return errc::is_a_directory;
default:
if (EC)
return EC;
More information about the llvm-commits
mailing list