Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 3d8634e

Browse files
William Douglasbryteise
authored andcommitted
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 <[email protected]>
1 parent 5ebfce0 commit 3d8634e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/swupd_lib/manifest_parser.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ struct manifest *manifest_parse(const char *component, const char *filename, boo
218218
struct list *optional = NULL;
219219
unsigned long long filecount = 0;
220220
unsigned long long contentsize = 0;
221+
static bool bad_opt_warned = false;
221222

222223
infile = fopen(filename, "rbm");
223224
if (infile == NULL) {
@@ -377,7 +378,10 @@ struct manifest *manifest_parse(const char *component, const char *filename, boo
377378

378379
bitmask_translation = OPTIMIZED_BITMASKS[(unsigned char)line[2]];
379380
if (bitmask_translation > APX_7) {
380-
error("Skipping unsupported file optimization level\n");
381+
if (!bad_opt_warned) {
382+
bad_opt_warned = true;
383+
error("Skipping unsupported file optimization level\n");
384+
}
381385
FREE(file);
382386
continue;
383387
}

0 commit comments

Comments
 (0)