Skip to content

Commit

Permalink
Incidentally, fixing intermittent error on srlp unit tests
Browse files Browse the repository at this point in the history
This error was happening intermittently in my local, and now has
happened in the CI as well. Turns out ferror was not working well
with fclose, since it would mistakenly report an error while
errno is set to 0.
  • Loading branch information
italo-sampaio committed Nov 25, 2024
1 parent 560dd16 commit 151d332
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion firmware/src/powhsm/test/srlp/test_srlp.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,15 @@ int read_block_file(const char* file_name, char** buffer, size_t* len) {

*buffer = malloc(*len);
fread(*buffer, *len, 1, f);
fclose(f);

if (ferror(f)) {
return -1;
}

if (fclose(f)) {
return -1;
}

return 0;
}

Expand Down

0 comments on commit 151d332

Please sign in to comment.