Skip to content

Commit

Permalink
ima_boot_aggregate: TBROK on fread() failure
Browse files Browse the repository at this point in the history
fread() should read 1 byte, quit when it fails it.

This fixes warning: ignoring return value of ‘fread’ declared with
attribute ‘warn_unused_result’ [-Wunused-result].

Link: https://lore.kernel.org/ltp/[email protected]/
Signed-off-by: Petr Vorel <[email protected]>
  • Loading branch information
pevik committed Nov 14, 2024
1 parent 0eeb7fc commit ec41611
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ static void do_test(void)
break;
}
#endif
fread(event.data, event.header.len, 1, fp);
if (fread(event.data, event.header.len, 1, fp) != 1)
tst_brk(TBROK, "failed to read 1 byte");
}

SAFE_FCLOSE(fp);
Expand Down

0 comments on commit ec41611

Please sign in to comment.