Various improvements to MemoryBuffer::getFile:
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 1 Apr 2010 14:35:22 +0000 (14:35 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 1 Apr 2010 14:35:22 +0000 (14:35 +0000)
commit6a9cd415495cd2422502fa2b84835409ce80d4de
treef3cfa84cd14bcf32ce113e82208acc29a28c0ad0
parent0bf77de91fa3663b3bc189624569e2ff9a714f43
Various improvements to MemoryBuffer::getFile:

- Use a RAII object to close the FD.
- Use sys::StrError instead of thread-unsafe strerror calls.
- Recover gracefully if read returns zero. This works around an issue on
  DragonFlyBSD where /dev/null has an st_size of 136 but we can't read 136 bytes
  from it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100106 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/MemoryBuffer.cpp