summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc3
-rw-r--r--apt-pkg/contrib/mmap.cc4
-rw-r--r--apt-pkg/contrib/mmap.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 24e3f08d9..767951daf 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -43,7 +43,8 @@
#include <set>
#include <algorithm>
-#ifndef WORDS_BIGENDIAN
+#include <config.h>
+#ifdef WORDS_BIGENDIAN
#include <inttypes.h>
#endif
/*}}}*/
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index 4978446d2..9945b1606 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -106,7 +106,7 @@ bool MMap::Map(FileFd &Fd)
/* */
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)
@@ -266,7 +266,7 @@ DynamicMMap::~DynamicMMap()
{
if (Fd == 0)
{
- if (Base == 0)
+ if (validData() == false)
return;
#ifdef _POSIX_MAPPED_FILES
munmap(Base, WorkSpace);
diff --git a/apt-pkg/contrib/mmap.h b/apt-pkg/contrib/mmap.h
index e9baa9339..2bf2c1540 100644
--- a/apt-pkg/contrib/mmap.h
+++ b/apt-pkg/contrib/mmap.h
@@ -62,6 +62,7 @@ class MMap
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();