Add a check that next_archived_file doesn't return the same element.
Seen with the following, which I think shows a bug with "ar r" and
thin archives as you get two copies of artest.a in artest2.a.
$ rm tmpdir/artest*
$ ./ar rc tmpdir/artest.a tmpdir/bintest.o
$ ./ar rcT tmpdir/artest2.a tmpdir/artest.a
$ ./bfdtest1 tmpdir/artest.a
$ ./bfdtest1 tmpdir/artest2.a
$ ./ar rcT tmpdir/artest2.a tmpdir/artest.a
$ ./bfdtest1 tmpdir/artest2.a
oops: next_archived_file
last = next)
{
next = bfd_openr_next_archived_file (archive, last);
+ if (next == last)
+ die ("next_archived_file");
bfd_close (last);
count++;
}
last = next)
{
next = bfd_openr_next_archived_file (archive, last);
+ if (next == last)
+ die ("next_archived_file");
bfd_close (last);
count--;
}