diff options
Diffstat (limited to 'methods')
-rw-r--r-- | methods/makefile | 10 | ||||
-rw-r--r-- | methods/rred.cc | 17 |
2 files changed, 20 insertions, 7 deletions
diff --git a/methods/makefile b/methods/makefile index 4ee356cec..6ba51058e 100644 --- a/methods/makefile +++ b/methods/makefile @@ -94,8 +94,8 @@ SOURCE = bzip2.cc include $(PROGRAM_H) # SSH and lzma method symlink -binary: $(BIN)/ssh $(BIN)/lzma -veryclean: clean-$(BIN)/ssh clean-$(BIN)/lzma +binary: $(BIN)/ssh $(BIN)/lzma $(BIN)/xz +veryclean: clean-$(BIN)/ssh clean-$(BIN)/lzma clean-$(BIN)/xz $(BIN)/ssh: echo "Installing ssh method link" @@ -108,3 +108,9 @@ $(BIN)/lzma: ln -fs bzip2 $(BIN)/lzma clean-$(BIN)/lzma: -rm $(BIN)/lzma + +$(BIN)/xz: + echo "Installing xz method link" + ln -fs bzip2 $(BIN)/xz +clean-$(BIN)/xz: + -rm $(BIN)/xz diff --git a/methods/rred.cc b/methods/rred.cc index 1a18a381c..849973e1a 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->validData() == false) { + 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) |