diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-02-14 14:07:17 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-02-14 14:07:17 +0100 |
commit | 8d009e3e8ac6c6431a8bc79a07d9ad7c0295d160 (patch) | |
tree | 361496f3f028a8c876c1059fd547b0191237ce67 /methods/rred.cc | |
parent | 5645e8b1cebb57134df717b8339248811cb762f2 (diff) | |
parent | 94244f75f8280c9b4018736d503d17455c284b2d (diff) |
merged from debian-sid
Diffstat (limited to 'methods/rred.cc')
-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) |