From: Pino Toscano Date: Sat, 4 Aug 2012 08:20:30 +0000 (+0200) Subject: apt-pkg/contrib/mmap.cc: X-Git-Tag: 0.9.7.4~1^2~9 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/3ac981df108470b42b89d0d4a816a5e3ba58c501 apt-pkg/contrib/mmap.cc: - guard only the msync call with _POSIX_SYNCHRONIZED_IO rather than also the fallback code as it breaks APT on hurd since 0.9.7.3 as the fallback is now always used on non-linux (Closes: #683354) --- diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 3e6ef3520..df7cd2a59 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -156,11 +156,10 @@ bool MMap::Close(bool DoSync) /* This is done in syncronous mode - the docs indicate that this will not return till all IO is complete */ bool MMap::Sync() -{ +{ if ((Flags & UnMapped) == UnMapped) return true; - -#ifdef _POSIX_SYNCHRONIZED_IO + if ((Flags & ReadOnly) != ReadOnly) { if (SyncToFd != NULL) @@ -170,11 +169,12 @@ bool MMap::Sync() } else { +#ifdef _POSIX_SYNCHRONIZED_IO if (msync((char *)Base, iSize, MS_SYNC) < 0) return _error->Errno("msync", _("Unable to synchronize mmap")); +#endif } } -#endif return true; } /*}}}*/ @@ -185,8 +185,7 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) { if ((Flags & UnMapped) == UnMapped) return true; - -#ifdef _POSIX_SYNCHRONIZED_IO + unsigned long long PSize = sysconf(_SC_PAGESIZE); if ((Flags & ReadOnly) != ReadOnly) { @@ -198,11 +197,12 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop) } else { +#ifdef _POSIX_SYNCHRONIZED_IO if (msync((char *)Base+(unsigned long long)(Start/PSize)*PSize,Stop - Start,MS_SYNC) < 0) return _error->Errno("msync", _("Unable to synchronize mmap")); +#endif } } -#endif return true; } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 3aa1f7e86..2ad1134a8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,12 @@ apt (0.9.7.4) UNRELEASED; urgency=low [ Program translation updates ] * Polish (Michał Kułach) + [ Pino Toscano ] + * apt-pkg/contrib/mmap.cc: + - guard only the msync call with _POSIX_SYNCHRONIZED_IO rather + than also the fallback code as it breaks APT on hurd since 0.9.7.3 + as the fallback is now always used on non-linux (Closes: #683354) + -- David Kalnischkies Wed, 18 Jul 2012 11:45:57 +0200 apt (0.9.7.3) UNRELEASED; urgency=low