[Bug Fix] open_plugin.c update checksum check for spinning disks

Lang_id keys take LANG_LAST_INDEX_IN_ARRAY for the checksum
spinning disks did not have the code to do so

Change-Id: I617e1a5462d8d6c4830a9b59171bdd7167d5e7a1
This commit is contained in:
William Wilgus 2022-12-13 23:33:46 -05:00 committed by William Wilgus
parent c6c1d62489
commit eaf717744d

View file

@ -155,10 +155,14 @@ static int op_update_dat(struct open_plugin_entry_t *entry, bool clear)
/* Only read the hash lang id and checksum */ /* Only read the hash lang id and checksum */
uint32_t hash_langid_csum[3] = {0}; uint32_t hash_langid_csum[3] = {0};
const off_t hlc_sz = sizeof(hash_langid_csum); const off_t hlc_sz = sizeof(hash_langid_csum);
uint32_t csum = open_plugin_csum +
(lang_id <= OPEN_PLUGIN_LANG_INVALID ? 0 : LANG_LAST_INDEX_IN_ARRAY);
while (read(fd, &hash_langid_csum, hlc_sz) == hlc_sz) while (read(fd, &hash_langid_csum, hlc_sz) == hlc_sz)
{ {
if ((hash_langid_csum[0] == hash || (int32_t)hash_langid_csum[1] == lang_id) && if ((hash_langid_csum[0] == hash || (int32_t)hash_langid_csum[1] == lang_id) &&
hash_langid_csum[2] == open_plugin_csum) hash_langid_csum[2] == csum)
{ {
logf("OP update *Entry Exists* hash: %x langid: %d", logf("OP update *Entry Exists* hash: %x langid: %d",
hash_langid_csum[0], (int32_t)hash_langid_csum[1]); hash_langid_csum[0], (int32_t)hash_langid_csum[1]);