summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2013-02-19 19:36:55 +0000
committerDan Gohman <dan433584@gmail.com>2013-02-19 19:36:55 +0000
commit782609e1460ff6839112d793e62a7d8e9a152da2 (patch)
tree536bd9b2f08f0330507acfded464f7c05ad4e3d1 /llvm/lib
parent8739f7b7f6f67a69ef0adc57f29aa1bb180e0cb2 (diff)
downloadbcm5719-llvm-782609e1460ff6839112d793e62a7d8e9a152da2.tar.gz
bcm5719-llvm-782609e1460ff6839112d793e62a7d8e9a152da2.zip
Whitelist files and block devices instead of blacklisting fifos and
character devices. llvm-svn: 175549
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/MemoryBuffer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index b0a20853b5c..0d5d4d7954f 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -322,9 +322,10 @@ error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
return error_code(errno, posix_category());
}
- // If this is a named pipe or character device, we can't trust the size.
- // Create the memory buffer by copying off the stream.
- if (S_ISFIFO(FileInfo.st_mode) || S_ISCHR(FileInfo.st_mode)) {
+ // If this not a file or a block device (e.g. it's a named pipe
+ // or character device), we can't trust the size. Create the memory
+ // buffer by copying off the stream.
+ if (!S_ISREG(FileInfo.st_mode) && !S_ISBLK(FileInfo.st_mode)) {
return getMemoryBufferForStream(FD, Filename, result);
}
OpenPOWER on IntegriCloud