mrubyを超漢字で動作させる
Revision | aff65afe97cc241af396ceb8df15bed27788c108 (tree) |
---|---|
Zeit | 2014-07-12 20:36:45 |
Autor | cremno <cremno@mail...> |
Commiter | Yukihiro "Matz" Matsumoto |
check the return value of fwrite
@@ -952,7 +952,9 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp) | ||
952 | 952 | |
953 | 953 | result = mrb_dump_irep(mrb, irep, debug_info, &bin, &bin_size); |
954 | 954 | if (result == MRB_DUMP_OK) { |
955 | - fwrite(bin, bin_size, 1, fp); | |
955 | + if (fwrite(bin, sizeof(bin[0]), bin_size, fp) != bin_size) { | |
956 | + result = MRB_DUMP_WRITE_FAULT; | |
957 | + } | |
956 | 958 | } |
957 | 959 | |
958 | 960 | mrb_free(mrb, bin); |