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