Commit 55a31f3f authored by cremno's avatar cremno

check the return value of `fwrite`

parent ec45dbe1
...@@ -952,7 +952,9 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp) ...@@ -952,7 +952,9 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp)
result = mrb_dump_irep(mrb, irep, debug_info, &bin, &bin_size); result = mrb_dump_irep(mrb, irep, debug_info, &bin, &bin_size);
if (result == MRB_DUMP_OK) { if (result == MRB_DUMP_OK) {
fwrite(bin, bin_size, 1, fp); if (fwrite(bin, sizeof(bin[0]), bin_size, fp) != bin_size) {
result = MRB_DUMP_WRITE_FAULT;
}
} }
mrb_free(mrb, bin); mrb_free(mrb, bin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment