#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>
// 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)
{
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;
}