Skip to content

Commit

Permalink
Make FileOutputBuffer fail early if you pass a directory.
Browse files Browse the repository at this point in the history
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297679 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rui314 committed Mar 13, 2017
1 parent 85ad85b commit bb60730
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Support/FileOutputBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bb60730

Please sign in to comment.