mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
mmap of a zero length file returns null on some platforms, so hack around it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13121 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b61fc83ecb
commit
6893eadc95
@ -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