File nomemset_expicit.patch of Package gnulib

This work around is used if libc is not glibc 2.43 or above
and therefore does not have memset_explicit which is also
used in read-file and test-memset_explicit of gnulib.

---
 lib/read-file.c              |    9 +++++++++
 tests/test-memset_explicit.c |    2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

--- lib/read-file.c
+++ lib/read-file.c	2026-01-28 09:05:58.396252581 +0000
@@ -37,6 +37,15 @@
 /* Get errno. */
 #include <errno.h>
 
+#ifdef NO_memset_explicit
+#undef memset_explicit
+static inline void * memset_explicit (void *s, int c, size_t len)
+{
+  memset (s, c, len);
+  asm volatile ("" ::: "memory");
+  return s;
+}
+#endif
 /* Read a STREAM and return a newly allocated string with the content,
    and set *LENGTH to the length of the string.  The string is
    zero-terminated, but the terminating zero byte is not counted in
--- tests/test-memset_explicit.c
+++ tests/test-memset_explicit.c	2026-01-28 09:54:56.102577122 +0000
@@ -43,7 +43,7 @@ SIGNATURE_CHECK (memset_explicit, void *
 static char zero[SECRET_SIZE] = { 0 };
 
 /* Enable this to verify that the test is effective.  */
-#if 0
+#ifdef NO_memset_explicit
 # undef memset_explicit
 # define memset_explicit memset
 #endif
openSUSE Build Service is sponsored by