diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-07-12 09:43:38 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-07-12 09:43:38 +0900 |
| commit | 4f66de36c4531783da624a6ff0b8bfb22d083efd (patch) | |
| tree | 5590993254d309c3744f3cccd6aebe764d3c1056 | |
| parent | ec45dbe16a418f58414f039f1a3b734cd14f63b8 (diff) | |
| parent | 55a31f3f239e9ee1c09f1094b1bd6bbed07bf58b (diff) | |
| download | mruby-4f66de36c4531783da624a6ff0b8bfb22d083efd.tar.gz mruby-4f66de36c4531783da624a6ff0b8bfb22d083efd.zip | |
Merge pull request #2460 from cremno/mrb_dump_irep_binary-report-fwrite-failure
check the return value of `fwrite`
| -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); |
