X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b049975f5914bafe0d163233354710ef7c660b85..7b15b702b1f908595a2ae484117746587f8e03aa:/methods/copy.cc?ds=sidebyside diff --git a/methods/copy.cc b/methods/copy.cc index 8dd0bd3f5..e81d0022b 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -9,11 +9,13 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include + #include +#include #include #include #include -#include #include #include @@ -36,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; @@ -53,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) { @@ -80,11 +82,12 @@ 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()); + Hash.AddFD(Fd); Res.TakeHashes(Hash); + URIDone(Res); return true; }