summaryrefslogtreecommitdiffstats
path: root/gl/m4/memchr.m4
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2026-03-26 12:53:53 +0100
committerGitHub <noreply@github.com>2026-03-26 12:53:53 +0100
commit13e14a6bfd9f29cbfeab0c5161d2a994f97532e7 (patch)
tree3aa7186fe092e42783dc7e981dc39a74ea61c466 /gl/m4/memchr.m4
parent9d8503f90ef25b2cecd324dc118e441f40233ea8 (diff)
downloadmonitoring-plugins-13e14a6bfd9f29cbfeab0c5161d2a994f97532e7.tar.gz
Update/gnulib 2026 03 (#2247)HEADmaster
* Sync with the 202601-stable Gnulib code (4a3650d887) * Ignore more deps stuff in gnulib * Remove autogenerated gnulib files * Ignore more gnulib generated headers
Diffstat (limited to 'gl/m4/memchr.m4')
-rw-r--r--gl/m4/memchr.m435
1 files changed, 12 insertions, 23 deletions
diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4
index 1c2ecf1d..c5c74682 100644
--- a/gl/m4/memchr.m4
+++ b/gl/m4/memchr.m4
@@ -1,6 +1,6 @@
1# memchr.m4 1# memchr.m4
2# serial 20 2# serial 21
3dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2009-2026 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -21,7 +21,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
21 # https://bugzilla.redhat.com/show_bug.cgi?id=499689 21 # https://bugzilla.redhat.com/show_bug.cgi?id=499689
22 # memchr should not dereference overestimated length after a match 22 # memchr should not dereference overestimated length after a match
23 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 23 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
24 # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 24 # https://sourceware.org/PR10162
25 # memchr should cast the second argument to 'unsigned char'. 25 # memchr should cast the second argument to 'unsigned char'.
26 # This bug exists in Android 4.3. 26 # This bug exists in Android 4.3.
27 # Assume that memchr works on platforms that lack mprotect. 27 # Assume that memchr works on platforms that lack mprotect.
@@ -33,31 +33,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
33# include <unistd.h> 33# include <unistd.h>
34# include <sys/types.h> 34# include <sys/types.h>
35# include <sys/mman.h> 35# include <sys/mman.h>
36# ifndef MAP_FILE
37# define MAP_FILE 0
38# endif
39#endif 36#endif
40]], [[ 37]], [[
41 int result = 0; 38 int result = 0;
42 char *fence = NULL; 39 char *fence = NULL;
43#if HAVE_SYS_MMAN_H && HAVE_MPROTECT 40#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
44# if HAVE_MAP_ANONYMOUS 41 {
45 const int flags = MAP_ANONYMOUS | MAP_PRIVATE; 42 long int pagesize = sysconf (_SC_PAGESIZE);
46 const int fd = -1; 43 char *two_pages =
47# else /* !HAVE_MAP_ANONYMOUS */ 44 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
48 const int flags = MAP_FILE | MAP_PRIVATE; 45 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
49 int fd = open ("/dev/zero", O_RDONLY, 0666); 46 if (two_pages != (char *)(-1)
50 if (fd >= 0) 47 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
51# endif 48 fence = two_pages + pagesize;
52 { 49 }
53 long int pagesize = sysconf (_SC_PAGESIZE);
54 char *two_pages =
55 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
56 flags, fd, 0);
57 if (two_pages != (char *)(-1)
58 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
59 fence = two_pages + pagesize;
60 }
61#endif 50#endif
62 if (fence) 51 if (fence)
63 { 52 {