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

Paul Kocialkowski
2019-01-16T14:18:33Z

On Wed, 2019-01-16 at 13:20 +0200, Petri Latvala wrote:
> 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@intel.com>
> Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.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;
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering