#include <set>
#include <algorithm>
-#ifndef WORDS_BIGENDIAN
+#include <config.h>
+#ifdef WORDS_BIGENDIAN
#include <inttypes.h>
#endif
/*}}}*/
/* */
bool MMap::Close(bool DoSync)
{
- if ((Flags & UnMapped) == UnMapped || Base == 0 || iSize == 0)
+ if ((Flags & UnMapped) == UnMapped || validData() == false || iSize == 0)
return true;
if (DoSync == true)
{
if (Fd == 0)
{
- if (Base == 0)
+ if (validData() == false)
return;
#ifdef _POSIX_MAPPED_FILES
munmap(Base, WorkSpace);
inline void *Data() {return Base;};
inline unsigned long Size() {return iSize;};
inline void AddSize(unsigned long const size) {iSize += size;};
+ inline bool validData() const { return Base != (void *)-1 && Base != 0; };
// File manipulators
bool Sync();
+apt (0.8.11.3) UNRELEASED; urgency=low
+
+ [ David Kalnischkies ]
+ * apt-pkg/contrib/fileutl.cc:
+ - really detect bigendian machines by including config.h,
+ so we can really (Closes: #612986)
+ * apt-pkg/contrib/mmap.cc:
+ - Base has as 'valid' failure states 0 and -1 so add a simple
+ validData method to check for failure states
+
+ -- David Kalnischkies <kalnischkies@gmail.com> Mon, 14 Feb 2011 16:58:03 +0100
+
apt (0.8.11.2) unstable; urgency=low
[ Michael Vogt ]
if (Patch.gzFd() != NULL) {
unsigned long mapSize = Patch.Size();
DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0);
- if (dyn->Data() == 0) {
+ if (dyn->validData() == false) {
delete dyn;
return MMAP_FAILED;
}