summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/mmap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib/mmap.cc')
-rw-r--r--apt-pkg/contrib/mmap.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index e395e6cc7..abcae46fe 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -21,10 +21,6 @@
##################################################################### */
/*}}}*/
// Include Files /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/mmap.h"
-#endif
-
#define _BSD_SOURCE
#include <apt-pkg/mmap.h>
#include <apt-pkg/error.h>
@@ -35,6 +31,8 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
+
+#include <cstring>
/*}}}*/
// MMap::MMap - Constructor /*{{{*/
@@ -119,7 +117,7 @@ bool MMap::Sync()
#ifdef _POSIX_SYNCHRONIZED_IO
if ((Flags & ReadOnly) != ReadOnly)
- if (msync((char *)Base,iSize,MS_SYNC) != 0)
+ if (msync((char *)Base,iSize,MS_SYNC) < 0)
return _error->Errno("msync","Unable to write mmap");
#endif
return true;
@@ -136,7 +134,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
#ifdef _POSIX_SYNCHRONIZED_IO
unsigned long PSize = sysconf(_SC_PAGESIZE);
if ((Flags & ReadOnly) != ReadOnly)
- if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) != 0)
+ if (msync((char *)Base+(int)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0)
return _error->Errno("msync","Unable to write mmap");
#endif
return true;