]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/mmap.cc
* Applied patch from Peter Eisentraut <peter_e@gmx.net> to fix a
[apt.git] / apt-pkg / contrib / mmap.cc
index 88e71e8e348074e5cb5cef1a09b9d69e043813eb..abcae46feee411e0beb7b7bd97a057bf7264ff7a 100644 (file)
@@ -31,6 +31,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
+
+#include <cstring>
                                                                        /*}}}*/
 
 // MMap::MMap - Constructor                                            /*{{{*/
                                                                        /*}}}*/
 
 // MMap::MMap - Constructor                                            /*{{{*/
@@ -115,7 +117,7 @@ bool MMap::Sync()
    
 #ifdef _POSIX_SYNCHRONIZED_IO   
    if ((Flags & ReadOnly) != ReadOnly)
    
 #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;
         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)
 #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;
         return _error->Errno("msync","Unable to write mmap");
 #endif   
    return true;