Mercurial > hg > octave-kai > gnulib-hg
annotate lib/acl.c @ 6259:96c32553b4c6
Use a consistent style for including <config.h>.
* __fpending.c, acl.c, argmatch.c,
argp-help.c, argp-parse.c,
argp-pvh.c, backupfile.c, basename.c, c-stack.c,
calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c,
creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c,
dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c,
fd-safer.c, file-type.c, fileblocks.c, filemode.c,
filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c,
fsusage.c, ftruncate.c, full-write.c, fwriteerror.c,
getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c,
getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c,
hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c,
inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c,
memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c,
modechange.c, mountlist.c, open-safer.c, physmem.c,
pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c,
progreloc.c, putenv.c, quote.c, quotearg.c, readline.c,
readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c,
safe-read.c, same.c, save-cwd.c, savedir.c, sig2str.c,
strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c,
strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c,
strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c,
userspec.c, utimecmp.c, version-etc-fsf.c,
version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c,
xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c,
xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c:
Standardize inclusion of config.h.
* __fpending.h, dirfd.h, getdate.h, human.h,
inttostr.h: Removed inclusion of config.h from header files.
* inttostr.c: Adjusted in-tree users.
* timespec.h: Remove superfluous warning to include config.h.
* atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c,
gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c,
nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c,
unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 19 Sep 2005 17:28:14 +0000 |
parents | c47674a83a78 |
children | 6b31c8787689 |
rev | line source |
---|---|
3762 | 1 /* acl.c - access control lists |
2 | |
5907 | 3 Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. |
3762 | 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 2, or (at your option) | |
8 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, write to the Free Software Foundation, | |
5848
a48fb0e98c8c
*** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents:
4517
diff
changeset
|
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
3762 | 18 |
19 Written by Paul Eggert. */ | |
20 | |
6259
96c32553b4c6
Use a consistent style for including <config.h>.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5907
diff
changeset
|
21 #ifdef HAVE_CONFIG_H |
3762 | 22 # include <config.h> |
23 #endif | |
24 | |
4517 | 25 #include <sys/types.h> |
3762 | 26 #include <sys/stat.h> |
27 #ifndef S_ISLNK | |
28 # define S_ISLNK(Mode) 0 | |
29 #endif | |
30 | |
31 #include "acl.h" | |
32 | |
33 #include <errno.h> | |
34 #ifndef ENOSYS | |
35 # define ENOSYS (-1) | |
36 #endif | |
37 | |
38 #ifndef MIN_ACL_ENTRIES | |
39 # define MIN_ACL_ENTRIES 4 | |
40 #endif | |
41 | |
5907 | 42 /* Return 1 if FILE has a nontrivial access control list, 0 if not, |
3762 | 43 and -1 (setting errno) if an error is encountered. */ |
44 | |
45 int | |
5907 | 46 file_has_acl (char const *file, struct stat const *filestat) |
3762 | 47 { |
48 /* FIXME: This implementation should work on recent-enough versions | |
49 of HP-UX, Solaris, and Unixware, but it simply returns 0 with | |
50 POSIX 1003.1e (draft 17 -- abandoned), AIX, GNU/Linux, Irix, and | |
51 Tru64. Please see Samba's source/lib/sysacls.c file for | |
52 fix-related ideas. */ | |
53 | |
54 #if HAVE_ACL && defined GETACLCNT | |
5907 | 55 if (! S_ISLNK (filestat->st_mode)) |
3762 | 56 { |
5907 | 57 int n = acl (file, GETACLCNT, 0, NULL); |
3762 | 58 return n < 0 ? (errno == ENOSYS ? 0 : -1) : (MIN_ACL_ENTRIES < n); |
59 } | |
60 #endif | |
61 | |
62 return 0; | |
63 } |