diff options
author | Chris Demetriou <cgd@google.com> | 2009-04-24 19:48:21 +0000 |
---|---|---|
committer | Chris Demetriou <cgd@google.com> | 2009-04-24 19:48:21 +0000 |
commit | 6d1e3092b4f527690c739a113caa7a123959c807 (patch) | |
tree | 54e74a40d28849f3cd67e78620bb1012bef7e90c /gold/output.cc | |
parent | 40fde48809fd5e9473aa572eee879bb70ce81258 (diff) | |
download | gdb-6d1e3092b4f527690c739a113caa7a123959c807.zip gdb-6d1e3092b4f527690c739a113caa7a123959c807.tar.gz gdb-6d1e3092b4f527690c739a113caa7a123959c807.tar.bz2 |
2008-04-23 Elliott Hughes <enh@google.com>
* output.cc (Output_file::close): After short writes, continue
writing from the correct offset in the buffer being written.
Diffstat (limited to 'gold/output.cc')
-rw-r--r-- | gold/output.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gold/output.cc b/gold/output.cc index d70c37a..b532136 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -3460,15 +3460,20 @@ Output_file::close() if (this->map_is_anonymous_ && !this->is_temporary_) { size_t bytes_to_write = this->file_size_; + size_t offset = 0; while (bytes_to_write > 0) { - ssize_t bytes_written = ::write(this->o_, this->base_, bytes_to_write); + ssize_t bytes_written = ::write(this->o_, this->base_ + offset, + bytes_to_write); if (bytes_written == 0) gold_error(_("%s: write: unexpected 0 return-value"), this->name_); else if (bytes_written < 0) gold_error(_("%s: write: %s"), this->name_, strerror(errno)); else - bytes_to_write -= bytes_written; + { + bytes_to_write -= bytes_written; + offset += bytes_written; + } } } this->unmap(); |