From 3d8634edda813861f4551bd1ccdacb57894571d7 Mon Sep 17 00:00:00 2001 From: William Douglas Date: Mon, 22 Jan 2024 06:41:51 -0800 Subject: [PATCH] Avoid printing optimization level error repeatedly The error message about skipping unsupported file optimization levels only needs to be printed once so do that instead of potentially spamming it. Signed-off-by: William Douglas --- src/swupd_lib/manifest_parser.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/swupd_lib/manifest_parser.c b/src/swupd_lib/manifest_parser.c index ed4507a14..da0733a4d 100644 --- a/src/swupd_lib/manifest_parser.c +++ b/src/swupd_lib/manifest_parser.c @@ -218,6 +218,7 @@ struct manifest *manifest_parse(const char *component, const char *filename, boo struct list *optional = NULL; unsigned long long filecount = 0; unsigned long long contentsize = 0; + static bool bad_opt_warned = false; infile = fopen(filename, "rbm"); if (infile == NULL) { @@ -377,7 +378,10 @@ struct manifest *manifest_parse(const char *component, const char *filename, boo bitmask_translation = OPTIMIZED_BITMASKS[(unsigned char)line[2]]; if (bitmask_translation > APX_7) { - error("Skipping unsupported file optimization level\n"); + if (!bad_opt_warned) { + bad_opt_warned = true; + error("Skipping unsupported file optimization level\n"); + } FREE(file); continue; }