Mercurial > hg > octave-kai > gnulib-hg
diff lib/set-mode-acl.c @ 15572:dd7c06a51643
acl: Clean up Solaris code.
* lib/acl-internal.h: Remove no-op #if.
* lib/file-has-acl.c: Likewise.
* lib/set-mode-acl.c (qset_acl): Remove unused Solaris code.
* lib/copy-acl.c (qcopy_acl): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 06 Sep 2011 00:26:07 +0200 |
parents | 8c7936106a14 |
children | 3e19c8849877 |
line wrap: on
line diff
--- a/lib/set-mode-acl.c +++ b/lib/set-mode-acl.c @@ -203,56 +203,9 @@ # elif HAVE_FACL && defined GETACLCNT /* Solaris, Cygwin, not HP-UX */ -# if defined ACL_NO_TRIVIAL && 0 - /* Solaris 10 (newer version), which has additional API declared in - <sys/acl.h> (acl_t) and implemented in libsec (acl_set, acl_trivial, - acl_fromtext, ...). */ - - acl_t *aclp; - char acl_text[] = "user::---,group::---,mask:---,other:---"; - int ret; - int saved_errno; - - if (mode & S_IRUSR) acl_text[ 6] = 'r'; - if (mode & S_IWUSR) acl_text[ 7] = 'w'; - if (mode & S_IXUSR) acl_text[ 8] = 'x'; - if (mode & S_IRGRP) acl_text[17] = acl_text[26] = 'r'; - if (mode & S_IWGRP) acl_text[18] = acl_text[27] = 'w'; - if (mode & S_IXGRP) acl_text[19] = acl_text[28] = 'x'; - if (mode & S_IROTH) acl_text[36] = 'r'; - if (mode & S_IWOTH) acl_text[37] = 'w'; - if (mode & S_IXOTH) acl_text[38] = 'x'; - - if (acl_fromtext (acl_text, &aclp) != 0) - { - errno = ENOMEM; - return -1; - } - - ret = (desc < 0 ? acl_set (name, aclp) : facl_set (desc, aclp)); - saved_errno = errno; - acl_free (aclp); - if (ret < 0) - { - if (saved_errno == ENOSYS || saved_errno == EOPNOTSUPP) - return chmod_or_fchmod (name, desc, mode); - errno = saved_errno; - return -1; - } - - if (mode & (S_ISUID | S_ISGID | S_ISVTX)) - { - /* We did not call chmod so far, so the special bits have not yet - been set. */ - return chmod_or_fchmod (name, desc, mode); - } - return 0; - -# else /* Solaris, Cygwin, general case */ - int done_setacl = 0; -# ifdef ACE_GETACL +# ifdef ACE_GETACL /* Solaris also has a different variant of ACLs, used in ZFS and NFSv4 file systems (whereas the other ones are used in UFS file systems). */ @@ -419,7 +372,7 @@ if (ret == 0) done_setacl = 1; } -# endif +# endif if (!done_setacl) { @@ -458,8 +411,6 @@ } return 0; -# endif - # elif HAVE_GETACL /* HP-UX */ struct stat statbuf;