diff options
| author | cremno <[email protected]> | 2014-07-11 08:40:40 +0200 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-07-12 20:36:45 +0900 |
| commit | aff65afe97cc241af396ceb8df15bed27788c108 (patch) | |
| tree | 5590993254d309c3744f3cccd6aebe764d3c1056 /src/dump.c | |
| parent | 61ce5892cc61b7c115e4f28236b72155b9720be5 (diff) | |
| download | mruby-aff65afe97cc241af396ceb8df15bed27788c108.tar.gz mruby-aff65afe97cc241af396ceb8df15bed27788c108.zip | |
check the return value of `fwrite`
Diffstat (limited to 'src/dump.c')
| -rw-r--r-- | src/dump.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dump.c b/src/dump.c index b820f1a68..e019baa99 100644 --- a/src/dump.c +++ b/src/dump.c @@ -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); |
