aboutsummaryrefslogtreecommitdiff
path: root/elf/readlib.c
diff options
context:
space:
mode:
authorAdam Sampson <ats@offog.org>2024-05-06 18:16:32 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-07-08 22:14:22 +0200
commited2b8d3a866eb37e069f6a71bdf10421cd4c5e54 (patch)
tree2582e67364cebfe16932b302b60df00821a74ca8 /elf/readlib.c
parentab6045728f9f99729b8bdd07c3e2a6aba586794e (diff)
downloadglibc-ed2b8d3a866eb37e069f6a71bdf10421cd4c5e54.tar.xz
glibc-ed2b8d3a866eb37e069f6a71bdf10421cd4c5e54.zip
ldconfig: Move endswithn into a new header file
is_gdb_python_file is doing a similar test, so it can use this helper function as well. Signed-off-by: Adam Sampson <ats@offog.org> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/readlib.c')
-rw-r--r--elf/readlib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/elf/readlib.c b/elf/readlib.c
index 4d67c74136..32e8b8eb22 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -33,6 +33,7 @@
#include <gnu/lib-names.h>
#include <ldconfig.h>
+#include <endswith.h>
#define Elf32_CLASS ELFCLASS32
#define Elf64_CLASS ELFCLASS64
@@ -48,7 +49,7 @@ static bool
is_gdb_python_file (const char *name)
{
size_t len = strlen (name);
- return len > 7 && strcmp (name + len - 7, "-gdb.py") == 0;
+ return endswithn (name, len, "-gdb.py");
}
/* Returns 0 if everything is ok, != 0 in case of error. */