From 321f77a07f94c4e210ebf5658d4c00390d29845a Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 14 Feb 2018 10:25:53 +0000 Subject: [PATCH] Use the default value if ArchiveSizeMax is unspecified in daemon.conf Fixes: https://github.com/hughsie/fwupd/issues/405 --- data/daemon.conf | 4 ++-- src/fu-config.c | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/data/daemon.conf b/data/daemon.conf index 3fe9b465b..51ab19f4c 100644 --- a/data/daemon.conf +++ b/data/daemon.conf @@ -8,5 +8,5 @@ BlacklistDevices= # Uses semicolons as delimiter BlacklistPlugins=test -# Maximum archive size that can be loaded, in Mb -ArchiveSizeMax=512 +# Maximum archive size that can be loaded in Mb, with 0 for the default +ArchiveSizeMax=0 diff --git a/src/fu-config.c b/src/fu-config.c index 6e352fde4..2beeda064 100644 --- a/src/fu-config.c +++ b/src/fu-config.c @@ -279,6 +279,7 @@ gboolean fu_config_load (FuConfig *self, GError **error) { GFileMonitor *monitor; + guint64 archive_size_max; g_autofree gchar *config_file = NULL; g_auto(GStrv) devices = NULL; g_auto(GStrv) plugins = NULL; @@ -335,11 +336,12 @@ fu_config_load (FuConfig *self, GError **error) } /* get maximum archive size, defaulting to something sane */ - self->archive_size_max = g_key_file_get_uint64 (self->keyfile, - "fwupd", - "ArchiveSizeMax", - NULL); - self->archive_size_max *= 0x100000; + archive_size_max = g_key_file_get_uint64 (self->keyfile, + "fwupd", + "ArchiveSizeMax", + NULL); + if (archive_size_max > 0) + self->archive_size_max = archive_size_max *= 0x100000; /* load remotes */ if (!fu_config_load_remotes (self, error))