diff options
author | Bruno Haible <bruno@clisp.org> | 2008-06-08 20:33:08 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2008-06-08 20:33:08 +0200 |
commit | 3f5a64015c34e525c73ccda17d5e300c58ee7505 (patch) | |
tree | adf58cb48b17fd3e0078534647364ba585e3db15 /lib/set-mode-acl.c | |
parent | 7e766e7fc7aecffc5b37f4b799921de254a8450d (diff) | |
download | gnulib-3f5a64015c34e525c73ccda17d5e300c58ee7505.tar.gz |
Add support for AIX ACLs.
Diffstat (limited to 'lib/set-mode-acl.c')
-rw-r--r-- | lib/set-mode-acl.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/set-mode-acl.c b/lib/set-mode-acl.c index c25c5fe3d8..7ef39cfa2d 100644 --- a/lib/set-mode-acl.c +++ b/lib/set-mode-acl.c @@ -357,6 +357,31 @@ qset_acl (char const *name, int desc, mode_t mode) } return 0; +# elif HAVE_ACLX_GET && 0 /* AIX */ + + /* TODO: use aclx_fput or aclx_put, respectively */ + +# elif HAVE_STATACL /* older AIX */ + + union { struct acl a; char room[128]; } u; + int ret; + + u.a.acl_len = (char *) &u.a.acl_ext[0] - (char *) &u.a; /* no entries */ + u.a.acl_mode = mode & ~(S_IXACL | 0777); + u.a.u_access = (mode >> 6) & 7; + u.a.g_access = (mode >> 3) & 7; + u.a.o_access = mode & 7; + + if (desc != -1) + ret = fchacl (desc, &u.a, u.a.acl_len); + else + ret = chacl (name, &u.a, u.a.acl_len); + + if (ret < 0 && errno == ENOSYS) + return chmod_or_fchmod (name, desc, mode); + + return ret; + # else /* Unknown flavor of ACLs */ return chmod_or_fchmod (name, desc, mode); # endif |