glibc/SOURCES/glibc-RHEL-49549-6.patch

35 lines
977 B
Diff

commit a20bc2f6233a726c7df8eaa332b6e498bd59321f
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Nov 29 15:36:40 2024 +0100
elf: Add the endswith function to <endswith.h>
And include <stdbool.h> for a definition of bool.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
diff --git a/elf/endswith.h b/elf/endswith.h
index c6430c48be0c1071..3954e57f8eff0faa 100644
--- a/elf/endswith.h
+++ b/elf/endswith.h
@@ -17,6 +17,7 @@
#ifndef _ENDSWITH_H
#define _ENDSWITH_H
+#include <stdbool.h>
#include <string.h>
/* Return true if the N bytes at NAME end with with the characters in
@@ -30,4 +31,11 @@ endswithn (const char *name, size_t n, const char *suffix)
strlen (suffix)) == 0);
}
+/* Same as endswithn, but uses the entire SUBJECT for matching. */
+static inline bool
+endswith (const char *subject, const char *suffix)
+{
+ return endswithn (subject, strlen (subject), suffix);
+}
+
#endif /* _ENDSWITH_H */