diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-10-25 20:51:32 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-10-25 20:51:32 +0000 |
commit | 8613b9316c2c522e2378d7c0e8a11bda5ef6569d (patch) | |
tree | 43df326db87e048a61b7d437d43aa0ae25fb90a1 /gold | |
parent | 160f6c2f4aefb0b8d06483336d26daa27d42bdff (diff) | |
download | binutils-redhat-8613b9316c2c522e2378d7c0e8a11bda5ef6569d.tar.gz |
Issue a fatal error on bad fwrite return
* dwp.cc (Dwo_file::record_target_info): Issue a fatal error
on bad fwrite return.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 5 | ||||
-rw-r--r-- | gold/dwp.cc | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 4e52f32402..a15902ec59 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,10 @@ 2012-10-25 H.J. Lu <hongjiu.lu@intel.com> + * dwp.cc (Dwo_file::record_target_info): Issue a fatal error + on bad fwrite return. + +2012-10-25 H.J. Lu <hongjiu.lu@intel.com> + * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type on val. diff --git a/gold/dwp.cc b/gold/dwp.cc index aaee4650e5..92e3b6b84a 100644 --- a/gold/dwp.cc +++ b/gold/dwp.cc @@ -1458,7 +1458,9 @@ Dwp_output_file::record_target_info(const char*, int machine, // Write zeroes for the ELF header initially. We'll write // the actual header during finalize(). static const char buf[elfcpp::Elf_sizes<64>::ehdr_size] = { 0 }; - ::fwrite(buf, 1, this->next_file_offset_, this->fd_); + if (::fwrite(buf, 1, this->next_file_offset_, this->fd_) + < (size_t) this->next_file_offset_) + gold_fatal(_("%s: %s"), this->name_, strerror(errno)); } // Add a string to the debug strings section. |