diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-08-08 19:28:43 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-08-08 19:28:43 +0200 |
commit | 95f45727964767f11534eb5347af3fc3a8a6e020 (patch) | |
tree | b46822e20859ae18992de933b7ad5b115e07723c | |
parent | 2c941d896911dca364b3d38dc593f3bf6847f3e5 (diff) |
* apt-pkg/acquire-worker.cc:
- only pass a hash if we actually got one from the method
* methods/copy.cc:
- take hashes here too (*sigh*)
-rw-r--r-- | apt-pkg/acquire-worker.cc | 4 | ||||
-rw-r--r-- | methods/copy.cc | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 460f59961..739c9e32c 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -273,7 +273,9 @@ bool pkgAcquire::Worker::RunMessages() if(!expectedHash.empty()) { string hashTag = expectedHash.HashType()+"-Hash"; - RecivedHash = expectedHash.HashType() + ":" + LookupTag(Message, hashTag.c_str()); + string hashSum = LookupTag(Message, hashTag.c_str()); + if(!hashSum.empty()) + RecivedHash = expectedHash.HashType() + ":" + hashSum; if(_config->FindB("Debug::pkgAcquire::Auth", false) == true) { clog << "201 URI Done: " << Owner->DescURI() << endl diff --git a/methods/copy.cc b/methods/copy.cc index d737e3c33..8dd0bd3f5 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -12,6 +12,8 @@ #include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> +#include <apt-pkg/hashes.h> +#include <apt-pkg/fileutl.h> #include <sys/stat.h> #include <utime.h> @@ -78,7 +80,11 @@ bool CopyMethod::Fetch(FetchItem *Itm) To.OpFail(); return _error->Errno("utime",_("Failed to set modification time")); } - + + Hashes Hash; + FileFd Fd(Res.Filename, FileFd::ReadOnly); + Hash.AddFD(Fd.Fd(), Fd.Size()); + Res.TakeHashes(Hash); URIDone(Res); return true; } |