Check fwrite return code
This commit is contained in:
parent
8d05292667
commit
182a105a38
2 changed files with 10 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2014-03-14 Anthony Green <green@moxielogic.com>
|
||||||
|
|
||||||
|
* objcopy.c (copy_object): Check fwrite return code.
|
||||||
|
|
||||||
2014-03-14 Meador Inge <meadori@codesourcery.com>
|
2014-03-14 Meador Inge <meadori@codesourcery.com>
|
||||||
|
|
||||||
* dwarf.c (strnlen): Move prototype ...
|
* dwarf.c (strnlen): Move prototype ...
|
||||||
|
|
|
@ -1875,7 +1875,12 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
|
||||||
|
|
||||||
bfd_byte * contents = xmalloc (size);
|
bfd_byte * contents = xmalloc (size);
|
||||||
if (bfd_get_section_contents (ibfd, sec, contents, 0, size))
|
if (bfd_get_section_contents (ibfd, sec, contents, 0, size))
|
||||||
fwrite (contents, 1, size, f);
|
{
|
||||||
|
if (fwrite (contents, 1, size, f) != size)
|
||||||
|
fatal (_("error writing section contents to %s (error: %s)"),
|
||||||
|
pdump->filename,
|
||||||
|
strerror (errno));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
bfd_nonfatal_message (NULL, ibfd, sec,
|
bfd_nonfatal_message (NULL, ibfd, sec,
|
||||||
_("could not retrieve section contents"));
|
_("could not retrieve section contents"));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue