aboutsummaryrefslogtreecommitdiff
path: root/bfd/aout-adobe.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/aout-adobe.c')
-rw-r--r--bfd/aout-adobe.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index 89961d7..3abd88e 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -99,7 +99,8 @@ aout_adobe_object_p (abfd)
if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
!= EXEC_BYTES_SIZE) {
- bfd_set_error (bfd_error_wrong_format);
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
@@ -156,7 +157,8 @@ aout_adobe_callback (abfd)
for (;;) {
if (bfd_read ((PTR) ext, 1, sizeof (*ext), abfd) != sizeof (*ext)) {
- bfd_set_error (bfd_error_wrong_format);
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
return 0;
}
switch (ext->e_type[0]) {
@@ -310,8 +312,10 @@ aout_adobe_write_object_contents (abfd)
aout_adobe_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
- bfd_seek (abfd, (file_ptr) 0, SEEK_SET);
- bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd);
+ if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
+ || (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd)
+ != EXEC_BYTES_SIZE))
+ return false;
/* Now write out the section information. Text first, data next, rest
afterward. */
@@ -333,17 +337,23 @@ aout_adobe_write_object_contents (abfd)
}
/* Write final `sentinel` section header (with type of 0). */
- bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd);
+ if (bfd_write ((PTR) sentinel, 1, sizeof (*sentinel), abfd)
+ != sizeof (*sentinel))
+ return false;
/* Now write out reloc info, followed by syms and strings */
if (bfd_get_symcount (abfd) != 0)
{
- bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return false;
if (! aout_32_write_syms (abfd))
return false;
- bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return false;
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_CODE) {
@@ -352,7 +362,9 @@ aout_adobe_write_object_contents (abfd)
}
}
- bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET);
+ if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*exec_hdr(abfd))), SEEK_SET)
+ != 0)
+ return false;
for (sect = abfd->sections; sect; sect = sect->next) {
if (sect->flags & SEC_DATA) {
@@ -417,7 +429,8 @@ aout_adobe_set_section_contents (abfd, section, location, offset, count)
}
/* regardless, once we know what we're doing, we might as well get going */
- bfd_seek (abfd, section->filepos + offset, SEEK_SET);
+ if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
+ return false;
if (count != 0) {
return (bfd_write ((PTR)location, 1, count, abfd) == count) ?true:false;