summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Young <marky@lunarg.com>2017-04-25 10:35:54 -0600
committerMark Young <marky@lunarg.com>2017-04-26 01:30:22 -0600
commit121224ba0ee0f72af3517b508b85e672d71ebff7 (patch)
tree6f7ce1fbd0589a0b336e7c6df639b1b6d341e4a6
parent2381257c06384aff53d3286f086d078f05bf8866 (diff)
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
-rw-r--r--loader/loader.c12
1 files changed, 9 insertions, 3 deletions
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");