From 4aa6ef9e82f6bb14746a47a7d56789d5e982a1f5 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <dueno@redhat.com>
Date: Tue, 25 Dec 2018 07:38:26 +0100
Subject: [PATCH 26/36] trust: p11_token_load: Treat parse error as failure

Those conditions can happen when the trust file is corrupted, so it
makes more sense to treat them as a failure instead of programmer
error.
---
 trust/token.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/trust/token.c b/trust/token.c
index 030c17b..b91a1d0 100644
--- a/trust/token.c
+++ b/trust/token.c
@@ -377,16 +377,19 @@ p11_token_load (p11_token *token)
 	int ret;
 
 	ret = loader_load_path (token, token->path, &is_dir);
-	return_val_if_fail (ret >= 0, -1);
+	if (ret < 0)
+		return -1;
 	total += ret;
 
 	if (is_dir) {
 		ret = loader_load_path (token, token->anchors, &is_dir);
-		return_val_if_fail (ret >= 0, -1);
+		if (ret < 0)
+			return -1;
 		total += ret;
 
 		ret = loader_load_path (token, token->blacklist, &is_dir);
-		return_val_if_fail (ret >= 0, -1);
+		if (ret < 0)
+			return -1;
 		total += ret;
 	}
 
-- 
2.19.1

