Просмотр исходного кода

* apt-pkg/contrib/mmap.cc:
- have a dummy SyncToFd around in case of ReadOnly access to a
compressed file as we otherwise on Close() do not delete[] the
char buffer but munmap() it… (Closes: #673815)

David Kalnischkies лет назад: 14
Родитель
Сommit
6bae2c5108
2 измененных файлов с 5 добавлено и 0 удалено
  1. 1 0
      apt-pkg/contrib/mmap.cc
  2. 4 0
      debian/changelog

+ 1 - 0
apt-pkg/contrib/mmap.cc

@@ -84,6 +84,7 @@ bool MMap::Map(FileFd &Fd)
       if ((Flags & ReadOnly) != ReadOnly)
       if ((Flags & ReadOnly) != ReadOnly)
 	 return _error->Error("Compressed file %s can only be mapped readonly", Fd.Name().c_str());
 	 return _error->Error("Compressed file %s can only be mapped readonly", Fd.Name().c_str());
       Base = new unsigned char[iSize];
       Base = new unsigned char[iSize];
+      SyncToFd = new FileFd();
       if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
       if (Fd.Seek(0L) == false || Fd.Read(Base, iSize) == false)
 	 return _error->Error("Compressed file %s can't be read into mmap", Fd.Name().c_str());
 	 return _error->Error("Compressed file %s can't be read into mmap", Fd.Name().c_str());
       return true;
       return true;

+ 4 - 0
debian/changelog

@@ -7,6 +7,10 @@ apt (0.9.5) UNRELEASED; urgency=low
   * buildlib/inttypes.h.in:
   * buildlib/inttypes.h.in:
     - remove inttypes.h compatibility as providing such a c99 types
     - remove inttypes.h compatibility as providing such a c99 types
       compatibility conflicts with the usage of c99 type long long
       compatibility conflicts with the usage of c99 type long long
+  * apt-pkg/contrib/mmap.cc:
+    - have a dummy SyncToFd around in case of ReadOnly access to a
+      compressed file as we otherwise on Close() do not delete[] the
+      char buffer but munmap() it… (Closes: #673815)
 
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 21 May 2012 15:10:49 +0200
  -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 21 May 2012 15:10:49 +0200