]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd: Don't call bfd_write with 0 size
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 12 Mar 2024 21:02:55 +0000 (14:02 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 13 Mar 2024 13:55:44 +0000 (06:55 -0700)
There is no need to call bfd_write with 0 size.

* elf-strtab.c (_bfd_elf_strtab_emit): Don't call bfd_write with
0 size.

bfd/elf-strtab.c

index 5fdfac12bde7d7ab83031aca80d5fcb778e86857..b6c62f15fa0e8cd0081a500b3f338f8a08d41dba 100644 (file)
@@ -326,7 +326,7 @@ _bfd_elf_strtab_emit (register bfd *abfd, struct elf_strtab_hash *tab)
 
       BFD_ASSERT (tab->array[i]->refcount == 0);
       len = tab->array[i]->len;
-      if ((int) len < 0)
+      if ((int) len <= 0)
        continue;
 
       str = tab->array[i]->root.string;