diff options
Diffstat (limited to 'passes')
-rw-r--r-- | passes/cmds/write_file.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/passes/cmds/write_file.cc b/passes/cmds/write_file.cc index 9bf1a75a8..25ec4acc2 100644 --- a/passes/cmds/write_file.cc +++ b/passes/cmds/write_file.cc @@ -68,13 +68,10 @@ struct WriteFileFrontend : public Frontend { FILE *of = fopen(output_filename.c_str(), append_mode ? "a" : "w"); char buffer[64 * 1024]; + int bytes; - while (1) { - f->read(buffer, sizeof(buffer)); - if (f->gcount() <= 0) - break; - fwrite(buffer, f->gcount(), 1, of); - } + while (0 < (bytes = readsome(*f, buffer, sizeof(buffer)))) + fwrite(buffer, bytes, 1, of); fclose(of); } |