From 42ad29fa055dba473cf4cb5e9abb1a7d35f2afd2 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Thu, 14 Mar 2013 00:20:10 +0000 Subject: [Support] Fix lifetime of file descriptors when using MemoryBuffer. Clients of MemoryBuffer::getOpenFile expect it not to take ownership of the file descriptor passed in. So don't. llvm-svn: 176995 --- llvm/lib/Support/FileOutputBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/FileOutputBuffer.cpp') diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp index cd430f2..1ee69b6 100644 --- a/llvm/lib/Support/FileOutputBuffer.cpp +++ b/llvm/lib/Support/FileOutputBuffer.cpp @@ -70,8 +70,8 @@ error_code FileOutputBuffer::create(StringRef FilePath, if (EC) return EC; - OwningPtr MappedFile( - new mapped_file_region(FD, mapped_file_region::readwrite, Size, 0, EC)); + OwningPtr MappedFile(new mapped_file_region( + FD, true, mapped_file_region::readwrite, Size, 0, EC)); if (EC) return EC; -- cgit v1.1