mirror of https://github.com/apache/lucene.git
Correctly translate errors from mmap() into exceptions.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150602 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c429a5f1e6
commit
55e076372a
|
@ -39,11 +39,13 @@ void GCJIndexInput::open() {
|
|||
fileLength = sb.st_size;
|
||||
|
||||
// mmap the file
|
||||
data = RAW(::mmap(0, fileLength, PROT_READ, MAP_SHARED, fd, 0));
|
||||
if (data < 0)
|
||||
// cout << "mmapping " << buf << "\n";
|
||||
void* address = ::mmap(0, fileLength, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (address == MAP_FAILED)
|
||||
throw new IOException(JvNewStringLatin1(strerror(errno)));
|
||||
|
||||
// initialize pointer to the start of the file
|
||||
data = RAW(address);
|
||||
pointer = data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue