Improved glitch fix
[emacs.git] / lib / acl-errno-valid.c
bloba64d3d3b5b5cb22231cd7c750f8f5609abac5993
1 /* Test whether ACLs are well supported on this system.
3 Copyright 2013-2015 Free Software Foundation, Inc.
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.
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.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 Written by Paul Eggert. */
20 #include <config.h>
22 #include <acl.h>
24 #include <errno.h>
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)
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)
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;
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
49 case EOPNOTSUPP: return false;
50 default: return true;