(root)/
tar-1.35/
gnu/
acl-errno-valid.c
       1  /* Test whether ACLs are well supported on this system.
       2  
       3     Copyright 2013-2023 Free Software Foundation, Inc.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation, either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <https://www.gnu.org/licenses/>.
      17  
      18     Written by Paul Eggert.  */
      19  
      20  #include <config.h>
      21  
      22  #include <acl.h>
      23  
      24  #include <errno.h>
      25  
      26  /* Return true if errno value ERRNUM indicates that ACLs are well
      27     supported on this system.  ERRNUM should be an errno value obtained
      28     after an ACL-related system call fails.  */
      29  bool
      30  acl_errno_valid (int errnum)
      31  {
      32    /* Recognize some common errors such as from an NFS mount that does
      33       not support ACLs, even when local drives do.  */
      34    switch (errnum)
      35      {
      36      case EBUSY: return false;
      37      case EINVAL: return false;
      38  #if defined __APPLE__ && defined __MACH__
      39      case ENOENT: return false;
      40  #endif
      41      case ENOSYS: return false;
      42  
      43  #if defined ENOTSUP && ENOTSUP != EOPNOTSUPP
      44  # if ENOTSUP != ENOSYS /* Needed for the MS-Windows port of GNU Emacs.  */
      45      case ENOTSUP: return false;
      46  # endif
      47  #endif
      48  
      49      case EOPNOTSUPP: return false;
      50      default: return true;
      51      }
      52  }