diff options
author | Michael Vogt <mvo@debian.org> | 2011-02-14 12:05:35 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2011-02-14 12:05:35 +0100 |
commit | 1fc07a44e8191e00fc1566bfc15e8b370da77330 (patch) | |
tree | 94603cf04d736dc500130389f2ef5ba4b027c8bc /methods | |
parent | 1dda80929fcd62c287a84f1ecc1277fc39890efe (diff) | |
parent | 2cae0ccb49efbeebe33f364b61e639ebf2639bdd (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'methods')
-rw-r--r-- | methods/rred.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/methods/rred.cc b/methods/rred.cc index 1a18a381c..9ad0e4464 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -252,13 +252,20 @@ struct EdCommand { /*{{{*/ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/ FileFd &out_file, Hashes *hash) const { #ifdef _POSIX_MAPPED_FILES - MMap ed_cmds(Patch, MMap::ReadOnly); + MMap ed_cmds(MMap::ReadOnly); if (Patch.gzFd() != NULL) { unsigned long mapSize = Patch.Size(); - DynamicMMap dyn(0, mapSize, 0); - gzread(Patch.gzFd(), dyn.Data(), mapSize); - ed_cmds = dyn; - } + DynamicMMap* dyn = new DynamicMMap(0, mapSize, 0); + if (dyn->Data() == 0) { + delete dyn; + return MMAP_FAILED; + } + dyn->AddSize(mapSize); + gzread(Patch.gzFd(), dyn->Data(), mapSize); + ed_cmds = *dyn; + } else + ed_cmds = MMap(Patch, MMap::ReadOnly); + MMap in_file(From, MMap::ReadOnly); if (ed_cmds.Size() == 0 || in_file.Size() == 0) |