X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/6b4fbf83a4e059701065f443bc874a8de170ade1..443f5e8a3205162ec6933529c5ca0c95ad3f6941:/methods/copy.cc diff --git a/methods/copy.cc b/methods/copy.cc index 72896b4c0..e81d0022b 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -9,7 +9,10 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include +#include #include #include #include @@ -35,7 +38,7 @@ class CopyMethod : public pkgAcqMethod bool CopyMethod::Fetch(FetchItem *Itm) { URI Get = Itm->Uri; - string File = Get.Path; + std::string File = Get.Path; // Stat the file and send a start message struct stat Buf; @@ -52,7 +55,7 @@ bool CopyMethod::Fetch(FetchItem *Itm) // See if the file exists FileFd From(File,FileFd::ReadOnly); - FileFd To(Itm->DestFile,FileFd::WriteEmpty); + FileFd To(Itm->DestFile,FileFd::WriteAtomic); To.EraseOnFailure(); if (_error->PendingError() == true) { @@ -82,8 +85,9 @@ bool CopyMethod::Fetch(FetchItem *Itm) Hashes Hash; FileFd Fd(Res.Filename, FileFd::ReadOnly); - Hash.AddFD(Fd.Fd(), Fd.Size()); + Hash.AddFD(Fd); Res.TakeHashes(Hash); + URIDone(Res); return true; }