check the return value of fwrite

This commit is contained in:
cremno
2014-07-11 08:40:40 +02:00
committed by Yukihiro "Matz" Matsumoto
parent 61ce5892cc
commit aff65afe97
+3 -1
View File
@@ -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);
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);