summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 6e7c75032..f3784a58b 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -674,8 +674,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
{
// The files timestamp matches
if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
-
+ }
Decompression = true;
Local = true;
DestFile += ".decomp";
@@ -694,7 +696,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
+ }
if (FileName == DestFile)
Erase = true;
@@ -966,18 +971,18 @@ void pkgAcqMetaIndex::RetrievalDone(string Message)
// see if the download was a IMSHit
IMSHit = StringToBool(LookupTag(Message,"IMS-Hit"),false);
-
Complete = true;
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
- // The files timestamp matches
- if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == false)
- {
- // Move it into position
+ // If we get a IMS hit we can remove the empty file in partial
+ // othersie we move the file in place
+ if (IMSHit)
+ unlink(DestFile.c_str());
+ else
Rename(DestFile,FinalFile);
- }
+
chmod(FinalFile.c_str(),0644);
DestFile = FinalFile;
}