]> git.saurik.com Git - apt.git/blobdiff - methods/copy.cc
merged from lp:~mvo/apt/mvo
[apt.git] / methods / copy.cc
index 8dd0bd3f5037334005f29709d19d50feec618348..a6bb372a3754d9b8d72ee5f85f81b2ebf586904f 100644 (file)
@@ -13,7 +13,6 @@
 #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>
@@ -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;
 }