From 524d6a4ac0c2ed982242e68240d51dbbbdf42a35 Mon Sep 17 00:00:00 2001 From: Mark Young Date: Tue, 25 Apr 2017 10:35:54 -0600 Subject: loader: gh1681 - Restrict error in JSON Restrict the loader's JSON errors when reading ICD manifest files to only return an overall error if there are no valid drivers. Change-Id: I10edb1cdc7e4db9cfdc0b3595416f0614ed22867 --- loader/loader.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'loader') diff --git a/loader/loader.c b/loader/loader.c index 634395ee..48e90647 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -2762,18 +2762,24 @@ VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_t continue; } - res = loader_get_json(inst, file_str, &json); - if (NULL == json || res != VK_SUCCESS) { + VkResult temp_res = loader_get_json(inst, file_str, &json); + if (NULL == json || temp_res != VK_SUCCESS) { if (NULL != json) { cJSON_Delete(json); json = NULL; } - if (res == VK_ERROR_OUT_OF_HOST_MEMORY) { + // If we haven't already found an ICD, copy this result to + // the returned result. + if (num_good_icds == 0) { + res = temp_res; + } + if (temp_res == VK_ERROR_OUT_OF_HOST_MEMORY) { break; } else { continue; } } + res = temp_res; cJSON *item, *itemICD; item = cJSON_GetObjectItem(json, "file_format_version"); -- cgit v1.2.3