From fed8b570b7c50f1c36e4252dac60fe4a12f64045 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 13 Mar 2017 22:19:05 +0000 Subject: 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 llvm-svn: 297679 --- llvm/lib/Support/FileOutputBuffer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llvm/lib/Support/FileOutputBuffer.cpp') diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index 57e5a8d7871..731740d012d 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -57,6 +57,8 @@ FileOutputBuffer::create(StringRef FilePath, size_t Size, unsigned Flags) { // 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; -- cgit v1.2.3