X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/c9034b42ab8da606fc0214dbad54025fc4b586af..4bec02c237e8e218bc7d4bcf7142e0450480138b:/methods/copy.cc?ds=sidebyside diff --git a/methods/copy.cc b/methods/copy.cc index 8dd0bd3f5..a6bb372a3 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -53,7 +52,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 +79,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()); Res.TakeHashes(Hash); + URIDone(Res); return true; }