[Debtags-commits] [svn] r1590 - in tagcoll/trunk: . tagcoll
Enrico Zini
enrico at costa.debian.org
Fri Feb 17 16:31:27 UTC 2006
Author: enrico
Date: Fri Feb 17 16:31:26 2006
New Revision: 1590
Modified:
tagcoll/trunk/ (props changed)
tagcoll/trunk/tagcoll/MMapIndex.cc
Log:
r7376 at viaza: enrico | 2006-02-17 17:30:50 +0100
Throw when opening empty mmp indexes
Modified: tagcoll/trunk/tagcoll/MMapIndex.cc
==============================================================================
--- tagcoll/trunk/tagcoll/MMapIndex.cc (original)
+++ tagcoll/trunk/tagcoll/MMapIndex.cc Fri Feb 17 16:31:26 2006
@@ -72,18 +72,15 @@
off_t size = lseek(m_fd, 0, SEEK_END);
if (size == (off_t)-1)
- {
- close(m_fd);
throw SystemException(errno, "reading the size of index file " + m_filename);
- }
m_size = size;
+
+ if (m_size == 0)
+ throw ConsistencyCheckException("the mmap index file " + filename + " is empty");
// Map the file into memory
if ((m_buf = (const char*)mmap(0, m_size, PROT_READ, MAP_PRIVATE, m_fd, 0)) == MAP_FAILED)
- {
- close(m_fd);
throw SystemException(errno, string("mmapping file ") + m_filename);
- }
}
More information about the Debtags-commits
mailing list