summaryrefslogtreecommitdiff
path: root/libdw
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-04-19 14:33:36 +0200
committerMark Wielaard <mark@klomp.org>2021-05-12 11:56:57 +0200
commitadc201f81902f3015a841869756ed4b9b811fe33 (patch)
tree735ab647b6e749f7bbbd1cd88256f89c2de266a9 /libdw
parent857546d176a36d2b5dc18b81dcafa3fb8ec0123d (diff)
downloadelfutils-adc201f81902f3015a841869756ed4b9b811fe33.tar.gz
Come up with startswith function.
New function in system.h that returns true if a string has a given prefix, false otherwise. Use it in place of strncmp. Signed-off-by: Martin Liška <mliska@suse.cz>
Diffstat (limited to 'libdw')
-rw-r--r--libdw/ChangeLog4
-rw-r--r--libdw/dwarf_begin_elf.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index aa3e5ee2..b5462ef4 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-19 Martin Liska <mliska@suse.cz>
+
+ * dwarf_begin_elf.c (check_section): Use startswith.
+
2021-05-01 Mark Wielaard <mark@klomp.org>
* libdw_form.c (__libdw_form_val_compute_len): Check indirect
diff --git a/libdw/dwarf_begin_elf.c b/libdw/dwarf_begin_elf.c
index 757ac4fa..9e944b86 100644
--- a/libdw/dwarf_begin_elf.c
+++ b/libdw/dwarf_begin_elf.c
@@ -30,6 +30,8 @@
# include <config.h>
#endif
+#include <system.h>
+
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
@@ -138,7 +140,7 @@ check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp)
break;
}
else if (scnlen > 14 /* .gnu.debuglto_ prefix. */
- && strncmp (scnname, ".gnu.debuglto_", 14) == 0
+ && startswith (scnname, ".gnu.debuglto_")
&& strcmp (&scnname[14], dwarf_scnnames[cnt]) == 0)
break;
}