aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-08-25 18:56:11 +0000
committerIan Lance Taylor <ian@airs.com>1994-08-25 18:56:11 +0000
commit435b470ec338d435c8c63e1e813ca6c67e5f1cc7 (patch)
tree9f6a3aa44e856521c61379242a2ca9a5e4d39a74 /bfd/aoutx.h
parent6d04c6d475c350f7490a5ac95cb45d7b396744de (diff)
downloadgdb-435b470ec338d435c8c63e1e813ca6c67e5f1cc7.zip
gdb-435b470ec338d435c8c63e1e813ca6c67e5f1cc7.tar.gz
gdb-435b470ec338d435c8c63e1e813ca6c67e5f1cc7.tar.bz2
* aoutx.h (add_to_stringtab): Check for _bfd_stringtab_add error
before adding BYTES_IN_WORD.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index f62228d..1c716e2 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1764,6 +1764,7 @@ add_to_stringtab (abfd, tab, str, copy)
boolean copy;
{
boolean hash;
+ bfd_size_type index;
/* An index of 0 always means the empty string. */
if (*str == '\0')
@@ -1775,9 +1776,16 @@ add_to_stringtab (abfd, tab, str, copy)
if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
hash = false;
- /* Add BYTES_IN_WORD to the return value to account for the space
- taken up by the count. */
- return BYTES_IN_WORD + _bfd_stringtab_add (tab, str, hash, copy);
+ index = _bfd_stringtab_add (tab, str, hash, copy);
+
+ if (index != (bfd_size_type) -1)
+ {
+ /* Add BYTES_IN_WORD to the return value to account for the
+ space taken up by the string table size. */
+ index += BYTES_IN_WORD;
+ }
+
+ return index;
}
/* Write out a strtab. ABFD is already at the right location in the