[igt-dev] [PATCH i-g-t 17/21] lib/igt_core: Handle all failures to read .igtrc

Petri Latvala petri.latvala at intel.com
Wed Jan 16 11:20:46 UTC 2019


Parse error is not the only way to fail loading the file. A common
other error is the file not existing. Handle all failures to read
.igtrc by releasing the key store immediately.

Signed-off-by: Petri Latvala <petri.latvala at intel.com>
Cc: Paul Kocialkowski <paul.kocialkowski at bootlin.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 lib/igt_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 26dd2789..0cae9b6a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -591,7 +591,7 @@ static void common_init_config(void)
 	igt_key_file = g_key_file_new();
 	ret = g_key_file_load_from_file(igt_key_file, key_file_loc,
 					G_KEY_FILE_NONE, &error);
-	if (error && error->code == G_KEY_FILE_ERROR) {
+	if (!ret) {
 		g_error_free(error);
 		g_key_file_free(igt_key_file);
 		igt_key_file = NULL;
-- 
2.19.1



More information about the igt-dev mailing list