[llvm] r175549 - Whitelist files and block devices instead of blacklisting fifos and
Dan Gohman
dan433584 at gmail.com
Tue Feb 19 11:36:55 PST 2013
Author: djg
Date: Tue Feb 19 13:36:55 2013
New Revision: 175549
URL: http://llvm.org/viewvc/llvm-project?rev=175549&view=rev
Log:
Whitelist files and block devices instead of blacklisting fifos and
character devices.
Modified:
llvm/trunk/lib/Support/MemoryBuffer.cpp
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=175549&r1=175548&r2=175549&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Tue Feb 19 13:36:55 2013
@@ -322,9 +322,10 @@ error_code MemoryBuffer::getOpenFile(int
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);
}
More information about the llvm-commits
mailing list