summaryrefslogtreecommitdiff
path: root/bfd/irix-core.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-01-05 13:11:33 +0000
committerAlan Modra <amodra@bigpond.net.au>2002-01-05 13:11:33 +0000
commitb55d193279f3b0ae7753ac971187d99d3e0c85ee (patch)
tree8dac30e26b88d5f265667992dafc5151d4e83f9e /bfd/irix-core.c
parent794df144ceeb173b140e2968ab1880cc3ebea97a (diff)
downloadbinutils-redhat-b55d193279f3b0ae7753ac971187d99d3e0c85ee.tar.gz
* section.c (bfd_section_init): Remove unnecessary initialisations.
(bfd_section_list_clear): New function. (bfd_section_list_remove, bfd_section_list_insert): New macros. (_bfd_strip_section_from_output): Use them. * coffcode.h (coff_set_alignment_hook): Likewise. * elf32-mips.c (_bfd_mips_elf_final_link): Likewise. * elf64-mips.c (mips_elf64_final_link): Likewise. * elf64-mmix.c (mmix_elf_final_link): Likewise. * sunos.c (sunos_add_dynamic_symbols): Likewise. * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise. * bfd-in2.h: Regenerate. * netbsd-core.c (netbsd_core_file_p): Use bfd_make_section_anyway rather than doing our own section handling. Clean up after errors with bfd_release and bfd_section_list_clear. Handle unexpected flags. * aoutf1.h (sunos4_core_file_p): Likewise. * aix386-core.c (aix386_core_file_p): Likewise. * cisco-core.c (cisco_core_file_validate): Likewise. * ptrace-core.c (ptrace_unix_core_file_p): Likewise. * trad-core.c (trad_unix_core_file_p): Likewise. * hppabsd-core.c (hppabsd_core_core_file_p): Clean up after errors with bfd_release and bfd_section_list_clear. * hpux-core.c (hpux_core_core_file_p): Likewise. * irix-core.c (irix_core_core_file_p): Likewise. * lynx-core.c (lynx_core_file_p): Likewise. * osf-core.c (osf_core_core_file_p): Likewise. * rs6000-core.c (rs6000coff_core_p): Likewise. * sco5-core.c (sco5_core_file_p): Likewise.
Diffstat (limited to 'bfd/irix-core.c')
-rw-r--r--bfd/irix-core.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/bfd/irix-core.c b/bfd/irix-core.c
index 3ee3695b62..c1a99acd52 100644
--- a/bfd/irix-core.c
+++ b/bfd/irix-core.c
@@ -1,5 +1,6 @@
/* BFD back-end for Irix core files.
- Copyright 1993, 1994, 1996, 1999, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1996, 1999, 2001, 2002
+ Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus Support
@@ -109,7 +110,7 @@ irix_core_core_file_p (abfd)
core_signal (abfd) = coreout.c_sigcause;
if (bfd_seek (abfd, coreout.c_vmapoffset, SEEK_SET) != 0)
- return NULL;
+ goto fail;
for (i = 0; i < coreout.c_nvmap; i++)
{
@@ -146,7 +147,7 @@ irix_core_core_file_p (abfd)
vmap.v_len,
vmap.v_vaddr,
vmap.v_offset))
- return NULL;
+ goto fail;
}
/* Make sure that the regs are contiguous within the core file. */
@@ -157,21 +158,28 @@ irix_core_core_file_p (abfd)
if (idg->i_offset + idg->i_len != idf->i_offset
|| idf->i_offset + idf->i_len != ids->i_offset)
- return 0; /* Can't deal with non-contig regs */
+ goto fail; /* Can't deal with non-contig regs */
if (bfd_seek (abfd, idg->i_offset, SEEK_SET) != 0)
- return NULL;
+ goto fail;
- make_bfd_asection (abfd, ".reg",
- SEC_HAS_CONTENTS,
- idg->i_len + idf->i_len + ids->i_len,
- 0,
- idg->i_offset);
+ if (!make_bfd_asection (abfd, ".reg",
+ SEC_HAS_CONTENTS,
+ idg->i_len + idf->i_len + ids->i_len,
+ 0,
+ idg->i_offset))
+ goto fail;
/* OK, we believe you. You're a core file (sure, sure). */
bfd_default_set_arch_mach (abfd, bfd_arch_mips, 0);
return abfd->xvec;
+
+ fail:
+ bfd_release (abfd, core_hdr (abfd));
+ core_hdr (abfd) = NULL;
+ bfd_section_list_clear (abfd);
+ return NULL;
}
static char *