mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
Whitelist files and block devices instead of blacklisting fifos and
character devices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175549 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2b49dec41b
commit
a8eae3e358
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user