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