summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc20
1 files changed, 13 insertions, 7 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 8ec4ba2c0..bc6d8cead 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -263,8 +263,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
{
// The files timestamp matches
if (StringToBool(LookupTag(Message,"Alt-IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
-
+ }
Decompression = true;
Local = true;
DestFile += ".decomp";
@@ -283,7 +285,10 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
// The files timestamp matches
if (StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ {
+ unlink(FileName.c_str());
return;
+ }
if (FileName == DestFile)
Erase = true;
@@ -520,18 +525,19 @@ 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;
}