From cfc0c6d5146513fba856894506542facde9fc914 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 (cherry picked from commit 7b9cd2e3d7206cc895fc2e27df3b7bd987da6ef5) --- 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 f0efee461f..44f0549e6b 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -2735,7 +2735,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); }