From 183cb952e321235923bac03e7105e23a6732b7d4 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 18 Jan 2018 17:39:19 +0000 Subject: [PATCH] daemon: print warning only if val couldn't be parsed We don't want to print a warning if the setting is missing from the config file. That's totally normal (e.g. the config we ship has all its configs commented out). We *do* want to print a warning if the config is provided, but it couldn't be parsed as a proper `uint64`. Closes: #1215 Approved by: cgwalters --- src/daemon/rpmostreed-daemon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/daemon/rpmostreed-daemon.c b/src/daemon/rpmostreed-daemon.c index 0b43b373..f3012ba0 100644 --- a/src/daemon/rpmostreed-daemon.c +++ b/src/daemon/rpmostreed-daemon.c @@ -323,8 +323,9 @@ get_config_uint64 (GKeyFile *keyfile, guint64 r = g_key_file_get_uint64 (keyfile, DAEMON_CONFIG_GROUP, key, &local_error); if (!local_error) return r; - sd_journal_print (LOG_WARNING, "Bad value for key '%s': %s; using compiled defaults", - key, local_error->message); + if (g_error_matches (local_error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_INVALID_VALUE)) + sd_journal_print (LOG_WARNING, "Bad uint64 for '%s': %s; using compiled defaults", + key, local_error->message); } return default_val; }