diff options
author | mckusick <mckusick@FreeBSD.org> | 2007-02-26 00:42:17 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2007-02-26 00:42:17 +0000 |
commit | 271ce5854460a9894cb8c86e2850044b8c5bd432 (patch) | |
tree | 91c6f8134e57da754648a6474805784c84e7ee74 | |
parent | f4f08cb0377213949f23ed80214d424a57e1739b (diff) | |
download | FreeBSD-src-271ce5854460a9894cb8c86e2850044b8c5bd432.zip FreeBSD-src-271ce5854460a9894cb8c86e2850044b8c5bd432.tar.gz |
Implement the -h flag (set an ACL on a symbolic link).
Before this fix the -h flag was ignored (i.e. setfacl
always set the ACL on the file pointed to by the symbolic
link even when the -h flag requested that the ACL be set
on the symbolic link itself).
-rw-r--r-- | bin/setfacl/setfacl.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/setfacl/setfacl.c b/bin/setfacl/setfacl.c index 43a5545..b86dbb1 100644 --- a/bin/setfacl/setfacl.c +++ b/bin/setfacl/setfacl.c @@ -253,10 +253,20 @@ main(int argc, char *argv[]) if (need_mask && (set_acl_mask(&final_acl) == -1)) { warnx("failed to set ACL mask on %s", file->filename); carried_error++; - } else if (acl_set_file(file->filename, acl_type, - final_acl) == -1) { - carried_error++; - warn("acl_set_file() failed for %s", file->filename); + } else if (h_flag) { + if (acl_set_link_np(file->filename, acl_type, + final_acl) == -1) { + carried_error++; + warn("acl_set_link_np() failed for %s", + file->filename); + } + } else { + if (acl_set_file(file->filename, acl_type, + final_acl) == -1) { + carried_error++; + warn("acl_set_file() failed for %s", + file->filename); + } } acl_free(acl[ACCESS_ACL]); |