mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
mmap of a zero length file returns null on some platforms, so hack around it.
llvm-svn: 13121
This commit is contained in:
parent
0db103b4b3
commit
80db51134d
@ -50,6 +50,12 @@ static void OpenFile(const std::string &Filename, unsigned &Len, char* &BufPtr){
|
||||
std::cerr << "Error: cannot open file '" << Filename << "'\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
// If mmap decided that the files were empty, it might have returned a
|
||||
// null pointer. If so, make a new, fake pointer -- it shouldn't matter
|
||||
// what it contains, because Len is 0, and it should never be read.
|
||||
if (BufPtr == 0 && Len == 0)
|
||||
BufPtr = new char[1];
|
||||
}
|
||||
|
||||
static bool isNumberChar(char C) {
|
||||
|
Loading…
Reference in New Issue
Block a user