X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/256f68abcf71157df78ab1aee08e46ff1b4f2b66..d45c49fcef815431b5c1e84be89c5cc99eba52e9:/apt-pkg/contrib/mmap.cc?ds=sidebyside diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 88e71e8e3..abcae46fe 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -31,6 +31,8 @@ #include #include #include + +#include /*}}}*/ // MMap::MMap - Constructor /*{{{*/ @@ -115,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; @@ -132,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;