summaryrefslogtreecommitdiff
path: root/methods/copy.cc
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2007-08-06 10:45:59 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2007-08-06 10:45:59 -0300
commitded14999815cc2dea0fe1916ceacc307ea339d40 (patch)
treebc949fe3866d5f02ac54488037fd94048eb32319 /methods/copy.cc
parentcfc65c4a385e28bd4ce49278fb926e6d7933fc28 (diff)
* Add hash support to copy method. Thanks Anders Kaseorg by the patch
(closes: #436055)
Diffstat (limited to 'methods/copy.cc')
-rw-r--r--methods/copy.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/methods/copy.cc b/methods/copy.cc
index d737e3c33..72896b4c0 100644
--- a/methods/copy.cc
+++ b/methods/copy.cc
@@ -12,6 +12,7 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/acquire-method.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/hashes.h>
#include <sys/stat.h>
#include <utime.h>
@@ -79,6 +80,10 @@ bool CopyMethod::Fetch(FetchItem *Itm)
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;
}