diff options
author | Bruno Haible <bruno@clisp.org> | 2020-02-16 23:01:08 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-02-16 23:01:08 +0100 |
commit | f4693b0166bab83ab232dcd3cfd95906411d1110 (patch) | |
tree | 3a316adab9fa82cdccddecb90f5a2e311dc58ded /m4 | |
parent | c4804326a84a0131913317c2a3571cab76cfd2e7 (diff) | |
download | gnulib-f4693b0166bab83ab232dcd3cfd95906411d1110.tar.gz |
fchmodat: Make more future-proof.
* m4/fchmodat.m4 (gl_FUNC_FCHMODAT): Define
NEED_FCHMODAT_NONSYMLINK_FIX.
(gl_PREREQ_FCHMODAT): New macro.
* lib/fchmodat.c (fchmodat): Test NEED_FCHMODAT_NONSYMLINK_FIX. Access
/proc only on Linux. Return EOPNOTSUPP only on Linux and on platforms
without lchmod function.
* modules/fchmodat (configure.ac): Invoke gl_PREREQ_FCHMODAT.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/fchmodat.m4 | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4 index f284485dd9..e3f2f04816 100644 --- a/m4/fchmodat.m4 +++ b/m4/fchmodat.m4 @@ -1,4 +1,4 @@ -# fchmodat.m4 serial 3 +# fchmodat.m4 serial 4 dnl Copyright (C) 2004-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -65,7 +65,18 @@ AC_DEFUN([gl_FUNC_FCHMODAT], rm -f conftest.fchmodat]) case $gl_cv_func_fchmodat_works in *yes) ;; - *) REPLACE_FCHMODAT=1;; + *) + AC_DEFINE([NEED_FCHMODAT_NONSYMLINK_FIX], [1], + [Define to 1 if fchmodat+AT_SYMLINK_NOFOLLOW does not work right on non-symlinks.]) + REPLACE_FCHMODAT=1 + ;; esac fi ]) + +# Prerequisites of lib/fchmodat.c. +AC_DEFUN([gl_PREREQ_FCHMODAT], +[ + AC_CHECK_FUNCS_ONCE([lchmod]) + : +]) |