Skip to content

Commit

Permalink
Avoid printing optimization level error repeatedly
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bryteise committed Jan 22, 2024
1 parent 5ebfce0 commit 3d8634e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/swupd_lib/manifest_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3d8634e

Please sign in to comment.