Package Kit: Delete downloads failing the checksum check

Change-Id: I3a7a914ea88e7b7b5bcc79160f46a9b4fcbba01b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3619
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Stephan Aßmus 2021-01-10 18:15:12 +01:00 committed by Adrien Destugues
parent 29536a2334
commit 7e677f6465

View File

@ -594,6 +594,11 @@ BPackageManager::_PreparePackageChanges(
status_t error = DownloadPackage(url, entry,
package->Info().Checksum());
if (error != B_OK) {
if (error == B_BAD_DATA) {
// B_BAD_DATA is returned when there is a checksum
// mismatch. Make sure this download is not re-used.
entry.Remove();
}
DIE(error, "Failed to download package %s",
package->Info().Name().String());
}