[binutils-gdb] bfd: Don't call bfd_write with 0 size

H.J. Lu hjl@sourceware.org
Wed Mar 13 14:08:26 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=32235d90951b4b7c2976c61a28c30d82cb7a7588

commit 32235d90951b4b7c2976c61a28c30d82cb7a7588
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 12 14:02:55 2024 -0700

    bfd: Don't call bfd_write with 0 size
    
    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.

Diff:
---
 bfd/elf-strtab.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c
index 5fdfac12bde..b6c62f15fa0 100644
--- a/bfd/elf-strtab.c
+++ b/bfd/elf-strtab.c
@@ -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;


More information about the Binutils-cvs mailing list