This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[vms/committed]: Fix get_idxlen for long name on ivms
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils Development <binutils at sourceware dot org>
- Date: Wed, 23 Nov 2011 12:22:05 +0100
- Subject: [vms/committed]: Fix get_idxlen for long name on ivms
Hi,
a typo/thinko in get_idxlen resulted in wrong value returned for long name on ivms. This wrong value could create invalid archives.
Fixed by this patch, also adding a few comments.
Tristan.
bfd/
2011-11-23 Tristan Gingold <gingold@adacore.com>
* vms-lib.c (get_idxlen): Add comments. Fix type in sizeof.
(vms_write_index): Add comments.
Index: vms-lib.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-lib.c,v
retrieving revision 1.17
diff -c -r1.17 vms-lib.c
*** vms-lib.c 27 Jun 2011 08:41:00 -0000 1.17
--- vms-lib.c 23 Nov 2011 11:17:33 -0000
***************
*** 1542,1559 ****
{
if (is_elfidx)
{
if (idx->namlen > MAX_KEYLEN)
! return 9 + sizeof (struct vms_rfa);
else
return 9 + idx->namlen;
}
else
! return 7 + idx->namlen;
}
! /* Write the index. VBN is the first vbn to be used, and will contain
! on return the last vbn.
Can be called with ABFD set to NULL just to size the index.
Return TRUE on success. */
static bfd_boolean
--- 1542,1565 ----
{
if (is_elfidx)
{
+ /* 9 is the size of struct vms_elfidx without keyname. */
if (idx->namlen > MAX_KEYLEN)
! return 9 + sizeof (struct vms_kbn);
else
return 9 + idx->namlen;
}
else
! {
! /* 7 is the size of struct vms_idx without keyname. */
! return 7 + idx->namlen;
! }
}
! /* Write the index composed by NBR symbols contained in IDX.
! VBN is the first vbn to be used, and will contain on return the last vbn.
Can be called with ABFD set to NULL just to size the index.
+ If not null, TOPVBN will be assigned to the vbn of the root index tree.
+ IS_ELFIDX is true for elfidx (ie ia64) indexes layout.
Return TRUE on success. */
static bfd_boolean
***************
*** 1637,1645 ****
--- 1643,1653 ----
}
*(unsigned short *)kbn_blk = 0;
}
+ /* Allocate a new block for the keys. */
kbn_vbn = (*vbn)++;
kbn_sz = VMS_BLOCK_SIZE - 2;
}
+ /* Size of the chunk written to the current key block. */
if (kl + sizeof (struct vms_kbn) > kbn_sz)
kl_chunk = kbn_sz - sizeof (struct vms_kbn);
else