summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-18 17:48:55 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-10-20 10:37:46 +0200
commitde81b2e20f80bb5f42034863a9a974c815a45da5 (patch)
tree4c601ca61dcdd8090adf198fba2191c18d9c87d4 /apt-pkg/acquire-item.cc
parent12796fa241ad6b0e8ccd1025a3723e18324e17b0 (diff)
aborted reverify restores file owner and permission
If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 78402249c..9a6e0af01 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -246,7 +246,7 @@ void pkgAcquire::Item::QueueURI(ItemDesc &Item) /*{{{*/
if (RealFileExists(DestFile))
{
std::string SandboxUser = _config->Find("APT::Sandbox::User");
- ChangeOwnerAndPermissionOfFile("GetPartialFileName", DestFile.c_str(),
+ ChangeOwnerAndPermissionOfFile("Item::QueueURI", DestFile.c_str(),
SandboxUser.c_str(), "root", 0600);
}
Owner->Enqueue(Item);
@@ -1570,6 +1570,10 @@ void pkgAcqMetaBase::AbortTransaction()
if(FileExists(PartialFile))
Rename(PartialFile, PartialFile + ".FAILED");
}
+ // fix permissions for existing files which were part of a reverify
+ // like InRelease files or files in partial we might work with next time
+ else if (FileExists((*I)->DestFile))
+ ChangeOwnerAndPermissionOfFile("AbortTransaction", (*I)->DestFile.c_str(), "root", "root", 0644);
}
Transaction.clear();
}