You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by cu...@apache.org on 2004/10/13 19:19:06 UTC
cvs commit: jakarta-lucene/src/gcj/org/apache/lucene/store GCJIndexInput.cc
cutting 2004/10/13 10:19:06
Modified: src/gcj/org/apache/lucene/store GCJIndexInput.cc
Log:
Correctly translate errors from mmap() into exceptions.
Revision Changes Path
1.2 +4 -2 jakarta-lucene/src/gcj/org/apache/lucene/store/GCJIndexInput.cc
Index: GCJIndexInput.cc
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/gcj/org/apache/lucene/store/GCJIndexInput.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GCJIndexInput.cc 20 Sep 2004 18:14:25 -0000 1.1
+++ GCJIndexInput.cc 13 Oct 2004 17:19:06 -0000 1.2
@@ -39,11 +39,13 @@
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org