libpldmresponder: Migrate to get_fru_record_by_option_check()
get_fru_record_by_option() is deprecated in libpldm as it relied on
assert() to communicate failures from the implementation.
get_fru_record_by_option_check() instead returns a value indicating
whether or not it succeeded.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I621bdcc713e37bb12ac40825edb399b151123427
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index 92d9290..dac7ff2 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -279,11 +279,11 @@
size_t recordTableSize = table.size() - padBytes + 7;
fruData.resize(recordTableSize, 0);
- get_fru_record_by_option(table.data(), table.size() - padBytes,
- fruData.data(), &recordTableSize,
- recordSetIdentifer, recordType, fieldType);
+ int rc = get_fru_record_by_option_check(
+ table.data(), table.size() - padBytes, fruData.data(), &recordTableSize,
+ recordSetIdentifer, recordType, fieldType);
- if (recordTableSize == 0)
+ if (rc != PLDM_SUCCESS || recordTableSize == 0)
{
return PLDM_FRU_DATA_STRUCTURE_TABLE_UNAVAILABLE;
}