summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-02-13 11:37:22 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-02-13 11:37:22 +0100
commit005428387832e79e314bb8f2605f7e6c69708d14 (patch)
tree9050f687a150b6f6071398e12004f8c19ff4bc8e /methods
parent26b37f959350860a0c1d5ef9651efa0bf3640cb5 (diff)
update size of dynamic MMap as we write in from the outside
Diffstat (limited to 'methods')
-rw-r--r--methods/rred.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/methods/rred.cc b/methods/rred.cc
index 80cd14986..9ad0e4464 100644
--- a/methods/rred.cc
+++ b/methods/rred.cc
@@ -255,9 +255,14 @@ RredMethod::State RredMethod::patchMMap(FileFd &Patch, FileFd &From, /*{{{*/
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);