From 3dbb92e5d5fac147eb5b6163ecd0d9e775024ac3 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 30 Mar 2020 12:07:18 -0500 Subject: [PATCH] trivial: fu-config: Fix behavior for UpdateMotd key If the file was missing or corrupted the default behavior for this key should be "TRUE". --- src/fu-config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fu-config.c b/src/fu-config.c index 2cb2b171a..a2015f763 100644 --- a/src/fu-config.c +++ b/src/fu-config.c @@ -56,6 +56,7 @@ fu_config_reload (FuConfig *self, GError **error) g_auto(GStrv) plugins = NULL; g_autofree gchar *domains = NULL; g_autoptr(GKeyFile) keyfile = g_key_file_new (); + g_autoptr(GError) error_update_motd = NULL; g_autoptr(GError) error_enumerate_all = NULL; g_debug ("loading config values from %s", self->config_file); @@ -133,7 +134,11 @@ fu_config_reload (FuConfig *self, GError **error) self->update_motd = g_key_file_get_boolean (keyfile, "fwupd", "UpdateMotd", - NULL); + &error_update_motd); + if (!self->update_motd && error_update_motd != NULL) { + g_debug ("failed to read UpdateMotd key: %s", error_update_motd->message); + self->update_motd = TRUE; + } /* whether to only show supported devices for some plugins */ self->enumerate_all_devices = g_key_file_get_boolean (keyfile,