reorder includes: add <config.h> if needed and include it at first
[ntk/apt.git] / methods / copy.cc
index 72896b4..94467e0 100644 (file)
@@ -9,6 +9,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include <config.h>
+
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
@@ -52,7 +54,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)
    {
@@ -84,6 +86,7 @@ bool CopyMethod::Fetch(FetchItem *Itm)
    FileFd Fd(Res.Filename, FileFd::ReadOnly);
    Hash.AddFD(Fd.Fd(), Fd.Size());
    Res.TakeHashes(Hash);
+
    URIDone(Res);
    return true;
 }