Use the default value if ArchiveSizeMax is unspecified in daemon.conf

Fixes: https://github.com/hughsie/fwupd/issues/405
This commit is contained in:
Richard Hughes 2018-02-14 10:25:53 +00:00
parent 919f8ab910
commit 321f77a07f
2 changed files with 9 additions and 7 deletions

View File

@ -8,5 +8,5 @@ BlacklistDevices=
# Uses semicolons as delimiter # Uses semicolons as delimiter
BlacklistPlugins=test BlacklistPlugins=test
# Maximum archive size that can be loaded, in Mb # Maximum archive size that can be loaded in Mb, with 0 for the default
ArchiveSizeMax=512 ArchiveSizeMax=0

View File

@ -279,6 +279,7 @@ gboolean
fu_config_load (FuConfig *self, GError **error) fu_config_load (FuConfig *self, GError **error)
{ {
GFileMonitor *monitor; GFileMonitor *monitor;
guint64 archive_size_max;
g_autofree gchar *config_file = NULL; g_autofree gchar *config_file = NULL;
g_auto(GStrv) devices = NULL; g_auto(GStrv) devices = NULL;
g_auto(GStrv) plugins = 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 */ /* get maximum archive size, defaulting to something sane */
self->archive_size_max = g_key_file_get_uint64 (self->keyfile, archive_size_max = g_key_file_get_uint64 (self->keyfile,
"fwupd", "fwupd",
"ArchiveSizeMax", "ArchiveSizeMax",
NULL); NULL);
self->archive_size_max *= 0x100000; if (archive_size_max > 0)
self->archive_size_max = archive_size_max *= 0x100000;
/* load remotes */ /* load remotes */
if (!fu_config_load_remotes (self, error)) if (!fu_config_load_remotes (self, error))