From a9a31b1de5776a3b08a82101a4fa711294f0dd1d Mon Sep 17 00:00:00 2001 From: "Manuel A. Fernandez Montecelo" Date: Fri, 27 May 2016 14:28:30 +0100 Subject: Imported Upstream version 0.9.6+really0.9.3 --- gnulib-m4/fcntl-o.m4 | 95 ++++++++++++---------------------------------------- 1 file changed, 21 insertions(+), 74 deletions(-) (limited to 'gnulib-m4/fcntl-o.m4') diff --git a/gnulib-m4/fcntl-o.m4 b/gnulib-m4/fcntl-o.m4 index 891a62f..d416a61 100644 --- a/gnulib-m4/fcntl-o.m4 +++ b/gnulib-m4/fcntl-o.m4 @@ -1,5 +1,5 @@ -# fcntl-o.m4 serial 4 -dnl Copyright (C) 2006, 2009-2015 Free Software Foundation, Inc. +# fcntl-o.m4 serial 1 +dnl Copyright (C) 2006, 2009-2010 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. @@ -12,26 +12,13 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_FCNTL_O_FLAGS], [ dnl Persuade glibc to define O_NOATIME and O_NOFOLLOW. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) - - AC_CHECK_HEADERS_ONCE([unistd.h]) - AC_CHECK_FUNCS_ONCE([symlink]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include - #if HAVE_UNISTD_H - # include - #else /* on Windows with MSVC */ - # include - # include - # defined sleep(n) _sleep ((n) * 1000) - #endif + #include #include #ifndef O_NOATIME #define O_NOATIME 0 @@ -46,74 +33,34 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], }; ]], [[ - int result = !constants; - #if HAVE_SYMLINK + int status = !constants; { static char const sym[] = "conftest.sym"; - if (symlink ("/dev/null", sym) != 0) - result |= 2; - else - { - int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); - if (fd >= 0) - { - close (fd); - result |= 4; - } - } - if (unlink (sym) != 0 || symlink (".", sym) != 0) - result |= 2; - else - { - int fd = open (sym, O_RDONLY | O_NOFOLLOW); - if (fd >= 0) - { - close (fd); - result |= 4; - } - } + if (symlink (".", sym) != 0 + || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0) + status |= 32; unlink (sym); } - #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); - if (fd < 0) - result |= 8; - else - { - struct stat st0; - if (fstat (fd, &st0) != 0) - result |= 16; - else - { - char c; - sleep (1); - if (read (fd, &c, 1) != 1) - result |= 24; - else - { - if (close (fd) != 0) - result |= 32; - else - { - struct stat st1; - if (stat (file, &st1) != 0) - result |= 40; - else - if (st0.st_atime != st1.st_atime) - result |= 64; - } - } - } - } + char c; + struct stat st0, st1; + if (fd < 0 + || fstat (fd, &st0) != 0 + || sleep (1) != 0 + || read (fd, &c, 1) != 1 + || close (fd) != 0 + || stat (file, &st1) != 0 + || st0.st_atime != st1.st_atime) + status |= 64; } - return result;]])], + return status;]])], [gl_cv_header_working_fcntl_h=yes], [case $? in #( - 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + 96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( *) gl_cv_header_working_fcntl_h='no';; esac], [gl_cv_header_working_fcntl_h=cross-compiling])]) -- cgit v1.2.3