From 7b9cd2e3d7206cc895fc2e27df3b7bd987da6ef5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Dec 2018 07:29:38 +0100 Subject: [PATCH] core: fix printing error for failure reading secret-key g_file_get_contents() fails with G_FILE_ERROR, G_FILE_ERROR_NOENT when the file does not exist. That wasn't obvious to me, nm_utils_error_is_notfound() to the rescue. Fixes: dbcb1d6d97c609d53dac4a86dc45d0e2595d8857 --- src/nm-core-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 6f168da3ae..c0feaa9465 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -2533,7 +2533,7 @@ _secret_key_read (guint8 **out_secret_key, nm_log_warn (LOGD_CORE, "secret-key: too short secret key in \"%s\" (generate new key)", NMSTATEDIR "/secret_key"); nm_clear_g_free (&secret_key); } else { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) { + if (!nm_utils_error_is_notfound (error)) { nm_log_warn (LOGD_CORE, "secret-key: failure reading secret key in \"%s\": %s (generate new key)", NMSTATEDIR "/secret_key", error->message); }