diff options
Diffstat (limited to 'gnulib-m4/strncat.m4')
-rw-r--r-- | gnulib-m4/strncat.m4 | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/gnulib-m4/strncat.m4 b/gnulib-m4/strncat.m4 index 9bff2cd2..81a0ce6a 100644 --- a/gnulib-m4/strncat.m4 +++ b/gnulib-m4/strncat.m4 @@ -1,9 +1,10 @@ # strncat.m4 -# serial 9 -dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. +# serial 10 +dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_STRNCAT], [ @@ -28,31 +29,20 @@ AC_DEFUN_ONCE([gl_FUNC_STRNCAT], # include <unistd.h> # include <sys/types.h> # include <sys/mman.h> -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif #endif ]GL_MDA_DEFINES], [[ char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - long int pagesize = sysconf (_SC_PAGESIZE); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; - } + { + long int pagesize = sysconf (_SC_PAGESIZE); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } #endif if (fence) { |