summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-03-10 15:45:47 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-03-10 15:45:47 +0100
commit67da93c38eb3904b36537e025e2f63f77d830e20 (patch)
tree8ff57ccafb2f471fc97f97bfe8f0da11ca1eb7b1 /methods
parentc9952021ba65db0581f6053cd6d6e8bf7d563e8f (diff)
parenta75b8cfeb6d7e2468b19534d5b5872c3885f0e1c (diff)
merged from debian-sid
Diffstat (limited to 'methods')
-rw-r--r--methods/makefile10
-rw-r--r--methods/rred.cc17
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)