diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-03-14 00:20:10 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-03-14 00:20:10 +0000 |
commit | cc3a595ab938352f3acf8652c5858ddf879524a5 (patch) | |
tree | 1f67c816387fd6a44ecf54063cc9c283b06642a3 /include/llvm/Support/FileSystem.h | |
parent | 64a0a33307723957bf2f15e3181a290853c6f833 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/FileSystem.h')
-rw-r--r-- | include/llvm/Support/FileSystem.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index bae3a5a608..ffa642787b 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -602,7 +602,7 @@ private: void *FileMappingHandle; #endif - error_code init(int FD, uint64_t Offset); + error_code init(int FD, bool CloseFD, uint64_t Offset); public: typedef char char_type; @@ -633,8 +633,10 @@ public: error_code &ec); /// \param fd An open file descriptor to map. mapped_file_region takes - /// ownership. It must have been opended in the correct mode. + /// ownership if closefd is true. It must have been opended in the correct + /// mode. mapped_file_region(int fd, + bool closefd, mapmode mode, uint64_t length, uint64_t offset, |